Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

(AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

Posted on by Microsoft Employee

Greetings, everyone!

I'm creating a new form which will use informations from a new table we created. Some of these informations are the code, name, batch and serial number from the items the user may add. However, I'm not being able to make the batch/serial numbers ComboBoxes show the available numbers... I've already included the InventDim table in the form DataSources, and I'm studying how it's used by other forms and testing some codes, but I'm not getting much success.

Does anyone know what are the right procedures to do? I've searched in many websites, but I didn't find anything.

Thanks in advance!
Luiz Bezerra

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Great...

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Hello, everyone!

    I could find an easier solution for what I needed, so I'm sharing here with you. It ended up being simpler than I thought. I just needed to add two relations in my new table: one with InventBatch table (linking the fields InventBatchId and ItemId) and another one with InventSerial table (linking InventSerialId and ItemId). I also needed to remove the ExtendedDataType from both fields (in my table, I mean). Otherwise, my comboboxes wouldn't show any serial numbers, but would show all the batch numbers, even the ones belonging to other items.

    Thanks for the help!

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Good evening Luiz,

    Follow this link for the suggested solution:

    www.robertmusau.com/.../8-adding-custom-lookup-query-code-in-ax-x

    In your case, override the lookup() method for the combobox that is to display the batch/serial numbers then on the lookup code, build a query of available numbers to the table that has the serial numbers. Let me know if this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Thanks for the quick answers, guys! I'll take a look at the InventDimCtrl_Frm and InventDimCtrl_Frm_Lookup classes, then.

  • Suggested answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    I don't have time to write all details on "How to use inventory dimension with Item"

    but all I can say it needs to use InventDimCtrl_Frm      

    you need to have your own implementation class extending from InventDimCtrl_Frm      

    The system/ AX is also having one class for each process like sales order, purchase order, production order.

    if you will explore AOT you will find many classes starting with InventDimCtrl_Frm

    microsoft-dynamics-ax-erp.blogspot.com/.../processing-business-tasks-building.html

    I hope you can do some effort to make it workable.

    it will automatically manage inventory dimensions, as per selected item.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Aha, so you want the lookup for allowed dimension values to be filtered by the item on the line, e.g. to see only serial IDs valid for item XYZ, correct?

    This is handled by special forms such as InventSerialIdLookup form. They're looking for a field called ItemId (on the datasource) or a method called itemId() (on the caller form). You can look into code (InventDimCtrl_Frm_Lookup class) to see how exactly it works.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    Hello! I'm sorry for not being able to properly express what I wanted do say... English is not my primary language, and I'm still kinda newbie when it comes to AX. Anyway, I'll try to explain better.

    Let me use the SalesTable Form as an example. After you add an item to a sales order, you can set its inventory dimensions, such as serial number, right? You do it by clicking a combobox, which will show you the available serial numbers for that item.

    Well, I'm creating a new form for a new process we call "revision order". I work at an UPS and AVR factory. Sometimes, an equipment we sold has some malfunction. So, the client send it back to us in order to repair it. We'll be monitoring the progress of the repairs with these revision orders. They'll work somehow similar to Production Orders.

    The user must include an item in the Revision Order and indicate its serial or batch number.

    Well, I just can't make my new form show the available serial/batch numbers for the chosen item, like the SalesTable or ProdTable forms do. When I click the batch number combobox, it shows me all the batch numbers, even the ones belonging to other items. When I click the serial number combobox, it shows me nothing.

    I don't know much how to work with the InventDim table and I've not found much information regarding this type of use of this table... What I want to know are the steps to follow to make my new form show (and save) properly the batch and serial numbers of the chosen items.

  • Martin Dráb Profile Picture
    Martin Dráb 230,056 Most Valuable Professional on at
    RE: (AX 2009) How to make a ComboBox display batch/serial numbers in a custom form?

    I'm not sure what you problem is, but I can tell you how InventDim works. If you use a new combination of inventory dimensions, a new record is created in InventDim and new InventDimId is assigned. This ID is then used by other tables such as SalesLine or InventTrans, which don't include fields for individual dimensions. Note that InventDim records never changes. You typically use InventDim::findOrCreate() method when looking for inventory dimensions - it either find the combination or creates a new one.

    Because InventDim isn't ever updated, notice that its datasource in SalesTable form (for example) never call super(). Instead, the InventDimId is found (or created) in write() method of SalesLine datasource.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans