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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Update delivery remainder for several lines (in X++)

(1) ShareShare
ReportReport
Posted on by 2,025
Hi,

If want to cancel multiple Saleslines, then we loop through SalesLine and use this code:
SalesUpdateRemain::updateDeliveryRemainder(SalesLine, 0, 0);

is there a way to cancel multiple lines at once? for example to pass a query and cancel some lines at once without looping through each line?
  • Raj Borad Profile Picture
    1,590 on at
    without looping you can't select the salesline for update.
    You can update the salesline delivery remainder of a particular salesorder.
    Code: 
    public void cancelSalesLines(SalesId _salesId)
    {
        SalesLine salesLine;
        Query query = new Query();
        QueryBuildDataSource qbds;
        qbds = query.addDataSource(tableNum(SalesLine));
        qbds.addRange(fieldNum(SalesLine, SalesId)).value(_salesId);
        // You can add more ranges to filter specific lines if needed
        ttsbegin;
        while select forUpdate salesLine
            where salesLine.SalesId == _salesId
        {
            // Cancel the sales line by setting the delivery remainder to 0
            SalesUpdateRemain::updateDeliveryRemainder(salesLine, 0, 0);
        }
        ttscommit;
    }
     

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

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 274 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 219

#3
Subra Profile Picture

Subra 202 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans