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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to unreserve quantity of a sales order through x++?

(0) ShareShare
ReportReport
Posted on by

I have reserved items of the sales order through x++. 

Suppose the ordered quantities are 10 and 10 quantities got reserved.

But now if I edit the sales order quantity from 10 to 8, then how can I update the reserved quantities? As 2 quantities should be unreserved and total reserved should be changed from 10 to 8.

How can I achieve this through X++?

I have the same question (0)
  • Suggested answer
    Shahil Profile Picture
    635 on at

    You can give this a try, some of the parameters are optional so you can tailor it to your requirements.

    Find reference on InventUpd_Reservation class to see more examples

    // Reserve quantity
    Qty reserveQty = 2
    // Inventory dimensions for 'On order' transactions
    InventDim inventDimFrom = InventDim::find(saleLine.InventDimId);
    
    // Create movement for the reservation
    InventMovement movement = InventMovement::construct(saleLine);
    
    // Match on all fields
    InventDimParm inventDimParm;
    inventDimParm.initFromInventDim(movement.inventdim());
    
    // Create reservation class
    InventUpd_Reservation reservation = InventUpd_Reservation::newParameters(movement,
                                                   inventDimFrom,
                                                   inventDimParm,
                                                   InventDimFixedClass::inventDimParm2InventDimFixed(inventDimParm),
                                                   -reserveQty,
                                                   false);
    // Set inventory dimension criteria to reserve against at the input location
    reservation.parmInventDimOnHandSelectionCriteria(inventDimTo);
    reservation.updateNow();

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans