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

How to get the location updated on one go for all SalesLine

(0) ShareShare
ReportReport
Posted on by 201
Hi ,
I have written a piece of code - when you change the order class, the salesline site and warehouse should also be updated. Thats working fine. Now issue is if I just click the save the location of the sales line doesnt get update. Now if i select any particular salesLine then its location gets updated. The tester wants that if i click save without selecting any salesline, the location should get updated for all the salesline at once. What am I missing?  this is the piece of code i have written to update site and warehouse which is working fine. 
SalesLine salesLine;
InventDim inventDim;

// Update all sales lines for this order with the specified field value
while select forupdate salesLine
    where salesLine.SalesId == _salesId
{
    // Use transaction control to ensure data consistency
    ttsbegin;
    
    // Load the related inventory dimension record
    inventDim = salesLine.inventDim();
        
    // Update the inventory dimension field
    inventDim.(_salesLineFieldId) = _fieldValue;                
        
    // Update the inventory dimension record
    salesLine.InventDimId = InventDim::findOrCreate(inventDim).inventDimId;     
        
    salesLine.doUpdate();
    ttscommit;

  }
 
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 669

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 445 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans