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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

get Invent Site (InventSiteId ) from WareHouse and Item by Code X++

(0) ShareShare
ReportReport
Posted on by

Hi all ! I want get auto InventSiteId for WareHouse  ! On Grid , when I select WareHouse then auto get Invent Site of Item. ( I set Default Order settings InventSite and Warehouse for item). Help me by code or solutions. Thanks all !

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Pravasti AK Profile Picture
    2,985 on at

    Hi Nguyen,

    static void _GetInventoryDimensions(Args _args)

    {

       InventTable                 inventTable = inventTable::find('Dxxxx);

       InventItemOrderSetupType    setupType   = InventItemOrderSetupType::Invent;

       InventDim                   inventDim;

       ;

       // Default Site

       inventDim.InventSiteId = inventTable.inventItemOrderSetupMap(setupType).inventSiteId(inventDim.InventSiteId, inventTable);

       // Default Location

       inventDim.InventLocationId  = inventTable.inventItemOrderSetupMap(setupType,

                                                                         InventDim::findOrCreate(inventDim).InventDimId)

                                                                         .inventLocationId(inventDim.InventLocationId,

                                                                                           inventTable,

                                                                                           inventDim.InventSiteId);

       // Default ConfigId

       inventDim.ConfigId = inventTable.StandardConfigId;

       // Find Default Item Dimension

       inventDim = InventDim::findOrCreate(inventDim);

       info(strFmt('Invent Dim. Id: %1', inventDim.inventDimId));

       info(strFmt('Site Id: %1', inventDim.InventSiteId));

       info(strFmt('Warehouse Id: %1', inventDim.InventLocationId));

    }

  • Community Member Profile Picture
    on at

    Thanks Kavitha Rajan ! but I need find InventSiteId with parameter is InventLocationId. I need auto display InventSiteId  on Grid when I select InventLocationId on a record ! help me a method !

  • Mea_ Profile Picture
    60,284 on at

    Try this:

    InventSiteId inventSiteId = InventLocation::find('myInventLocationId').InventSite().inventSiteId;


  • Suggested answer
    Pravasti AK Profile Picture
    2,985 on at

    Hi Nguyen,

    if (inventDim.InventSiteId)

    {

    inventLocationId  = inventTable.inventItemOrderSetupMap(InventItemOrderSetupType::Sales,

    InventDim::findOrCreate(inventDim).InventDimId).inventLocationId(inventDim.InventLocationId,

    inventTable,

    inventSiteID);

    print inventLocationId;

    pause;

    }

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans