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)

Changing Warehouse to Quarantine Warehouse using X++ code.

(0) ShareShare
ReportReport
Posted on by 2,486

Hi,

Can anybody tell me how to change the warehouse to quarantine warehouse if quarantine is checked through code.

Thanks,

Raziq

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    syed baber Profile Picture
    11,633 on at

    Hi Mohammad,

    You can set the warehouse to quarantine, by setting invent location type value to quarantine. The code should be as follows:

    InventLocation.InventLocationType = InventLocationType::Quarantine;

    Is this what you are looking for?

    Thanks,

    Baber.

  • Mohammad Raziq Ali Profile Picture
    2,486 on at

    Hi Baber,

    Actually, When record is created in item arrival journal, every time it goes for check whether it is QuarantineCheck is marked or not. if it is marked then warehouse should changed to quarantine warehouse in the form but in dimension tab.

    Is there any possibility so that we can change through code.

    Thanks,

    Raziq

  • syed baber Profile Picture
    11,633 on at

    Hi Mohammad,

    Do you want to change the warehouse showing under Dimensions tab to quarantine warehouse on Item arrival journal?

    Thanks,

    Baber.

  • Mohammad Raziq Ali Profile Picture
    2,486 on at

    yes baber.......

  • Verified answer
    syed baber Profile Picture
    11,633 on at

    Hi Mohammad,

    There is an InventDim data source on the form which is used to show the inventory dimension under Dimensions tab. You can use the below code snippet to achieve this:

    ttsbegin;

    select forUpdate InventLocationId from InventLocation

    where InventLocation.InventLocationId == InventDim.InventLocationId;

    if (InventLocation)

    {

    InventLocation.InventLocationType = InventLocationType::Quarantine;

    InventLocation.update();

    }

    ttscommit;

    You can write the above code in the init method of InventDim data source on form WMSJournalReception after super(). If you get any error by calling the update method above, then you can use doUpdate(), but keep in mind that it will bypass any standard validations exist in update method. Not sure what would be the impact of changing the warehouse type like this, so I would suggest you to do proper testing of this before moving this to production.

    Please verify and let me know if you have further queries.

    Thanks,

    Baber.

  • Suggested answer
    Mohammad Raziq Ali Profile Picture
    2,486 on at

    Hi Baber,

    I Wrote one class method in which I am passing WmsJournalTrans table buffer as a parameter and below is the code.

    public void updateQuarantineWh(WMSJournalTrans _wmsjournalTrans)
    {
    InventLocationId inventLocationId;
    InventLocationIdQuarantine inventLocationIdQuarantine;
    InventDim inventdim;
    ;
    inventLocationId = InventDim::find(_wmsjournalTrans.inventDimId).InventLocationId;
    inventLocationIdQuarantine = InventLocation::find(inventLocationId).InventLocationIdQuarantine;
    inventdim = InventDim::find(_wmsjournalTrans.inventDimId);
    inventdim.InventLocationId = inventLocationIdQuarantine;
    inventdim = InventDim::findOrCreate(inventdim);

    _wmsjournalTrans.inventDimId = inventdim.inventDimId;
    _wmsjournalTrans.update();

    // return inventLocationIdQuarantine;
    }

    This method will find quarantine warehouse of actual warehouse and update to inventdim table using findorCreate Method.

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans