web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How the UnitID and the ItemID Related

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I Have created a new Form and I Used many Fields from different datasources . I have to get the unitID of the Item ID I have mentioned, how to achieve this. I am new to ax 2012.

UnitID.PNG

Thanks & Regards

Ram.

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How the UnitID and the ItemID Related

    Yes, of course you can use display method.

    However InventJournalTrans quantity is related to inventory unit. So, if purchase unit is something different, your qty might not be correct.

    For example, if purchase unit is ton and inventory unit is kg.

    And your inventory transaction is 500 kg.

    If you now replace "kg" with "t" your form will show wrong data.

  • Ram Kumar Profile Picture
    454 on at
    RE: How the UnitID and the ItemID Related

    Hi Nikolaos,

    Sorry for the Mistake , My requirement is purchase Unit. shall i use Display method for the unit field instead of joining Datasources.  

    Thanks & Regards,

    Ram.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How the UnitID and the ItemID Related

    There is no InventDimModule table.

    By the way, your code is looking for the Purchase unit, but in InventJournalTrans we handle Inventory unit.

    Anyway, you should first determine what exact information you need, before writing any code. Look for the correct information in D365 user interface (with help of a functional consultant who perhaps defined the requirement), and once you find the info, figure out the data model beneath, and finally develop code to fetch the value.

  • Ram Kumar Profile Picture
    454 on at
    RE: How the UnitID and the ItemID Related

    Hi Nikolaos,

    I have tried this here is my code ,

    8508.purch.PNG

    I didn't got related unit for the itemid. My Form shows the UnitID which was in the order in Table. I need to get the Related UnitId from Inventdimmodule table which is related to Inventjournaltrans table's (Item Id). 

    Thanks & Regards,

    Ram.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How the UnitID and the ItemID Related

    InventTableModule has three records for every item id: Purchase order, Sales order and Inventory. Which one you want to show? Purch unit, sales unit or inventory unit? Based on that, you need to set the correct join relation (InventTableModule.ModuleType).

  • Ram Kumar Profile Picture
    454 on at
    RE: How the UnitID and the ItemID Related

    Hi Nikolaos,

    For example If we take Resin (Product) its unit is Lbs. I had taken the unit for the Item in Inventtablemodule Table. But by using the joins i have to take the correct Unit for the Itemid. My form shows the incorrect Unitid for the Itemid.

    Thanks & Regards,

    Ram.  

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: How the UnitID and the ItemID Related

    What Unit would you like to get? What data is it that you are showing here? 

    The product and it's transactions might have many different units. For example you might purchase in tons and sell in kilograms. Perhaps you need to talk to the person who defined the requirement for you, and ask which unit should be shown here?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,239

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 767 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 672 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans