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 :
Microsoft Dynamics AX (Archived)

X++ to update sales line reserve physical qty

(0) ShareShare
ReportReport
Posted on by 77

Hi

I have create a button and when user click on the button in sales order i want to update the reserve physical qty == deliver now qty

by default reserve physical qty == sales qty  but i want to update the reserve physical qty  == deliver now qty

does any on have  x++ code on how to update the reserve physical qty base on sales order

Thank you

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at
    RE: X++ to update sales line reserve physical qty

    This code is meaningless without your data, we don't know if there is inventTrans, so it would go inside of the if statement or you have enough in stock to reserve. Did you try to debug ?

  • Snifer Profile Picture
    77 on at
    RE: X++ to update sales line reserve physical qty

    thanks ievgen Miroshnikov but the code does not work in AX 2012 R3

    i am testing with below code but its not working;

    static void Job16(Args _args)
    {
        InventTrans             inventTrans;
        InventTransOrigin       inventTransOrigin;
        InventMovement          inventMovement;
        InventUpd_Reservation   inventUpd_Reservation ;
        
        // Reserve an item
        SalesLine SalesLine = SalesLine::findRecId(5640934326);
        select inventTrans
        where  inventTrans.ItemId                      == SalesLine.ItemId
        &&  inventTrans.StatusReceipt               == StatusReceipt::None
        &&  inventTrans.StatusIssue                 == StatusIssue::OnOrder
        exists join inventTransOrigin
        where   inventTransOrigin.RecId            == inventTrans.InventTransOrigin;
        
        if(inventTrans.RecId)
        
        {
            Inventmovement = inventTrans.inventmovement(true);
            inventUpd_Reservation = InventUpd_Reservation::newInventDim(inventmovement,SalesLine.inventDim(),-120, false);
            inventUpd_Reservation.updatenow();
        }
        
        info(strFmt("%1",salesLine.reservedPhysicalSalesUnit()));

    }

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: X++ to update sales line reserve physical qty

    Hi rdewan,

    Please check this blog post community.dynamics.com/.../reserving-inventory-by-code it has a code snippet how to reserve qty for sales order line, in this blog post Qty reserved is 5 but you can put  deliver now qty instead.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
KP-31070522-0 Profile Picture

KP-31070522-0 3

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans