Solved

Sales Order SO301000 - Update SO Line Sales Person ID when Order Default Sales Person ID Updated

  • 6 October 2023
  • 4 replies
  • 106 views

Userlevel 5
Badge +1

I am looking into customizing SO301000 to automatically update the SOLine SalesPersonID when ever the Order Default SalesPersonID is updated.

 

Occasionally, we will copy an order and change the customer ID. When you change the customer ID it removes the SOLine SalesPersonID from every line. We never have more than one salesperson on a sales order. So we would like to be able to quickly update every SOLine with the default salesperson ID by simply updating the Order Default SalesPersonID.

 

I thought maybe this could be handled with a document Event Handler or Events at the field level within the screen.

 

I have tested neither methods, because I am not too familiar with Event Handlers yet. I did create a test Event Handler but did not see the SOLine SalesPersonID field as an option to Update after changing the document default salespersonid.

 

Any ideas?

icon

Best answer by RohitRattan88 6 October 2023, 20:09

View original

4 replies

Userlevel 6
Badge +3

Hi @nathantrauscht 

You need something like this:

protected void _(Events.FieldUpdated<SOOrder.salesPersonID> e)
{
foreach (SOLine soLine in Base.Transactions.Select())
{
soLine.SalesPersonID = e.NewValue as int?;
Base.Transactions.Update(soLine);
}
}

 

Userlevel 5
Badge +1

@Zoltan Febert I will give that a try.

 

I don’t see a way to add an Event Handler and use code.

Where exactly should this code be added? Should it be added to the attributes of the field?

 

Also, is there no way to have it make the SOLine updates using an event handler?

 

Userlevel 7
Badge +4
Adding a graph extension to your customization project
Event handler code

 

Userlevel 5
Badge +1

@Zoltan Febert

@RohitRattan88 

Worked perfectly, thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved