Default Warehouse receipt location and Issue Location

Hi All,

How to find the default warehoue issue location and receipt location(Below screen shot) for the on hand item…?

And it is my code…

static void SK_DefaultLocation(Args _args)
{
    InventItemLocation location;
    WMSLocationId issue, receipt;
    InventSum inventsum;
    inventsum = InventSum::find('#9', '00008425_069');
    issue = InventLocation::find(inventsum.inventLocationId()).WMSlocationIdDefaultIssue;
    receipt =   InventLocation::find(inventsum.inventLocationId()).WMSLocationIdDefaultReceipt;
    info(strFmt('%1,%2',issue, receipt));;
}

Is my code correct?? Please suggest?

Thanks in advance…

Your code is OK. You can limit using InventLocatoin::find() only once.

Have a look \Data Dictionary\Tables\WMSLocation\Methods\defaultItemLocation. This is how AX finds the default locations.

And you don’t need InventSum to find the default locations, if you have the InventDimId.