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

Announcements

News and Announcements icon
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,286 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans