Skip to main content
Answer

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

  • October 5, 2023
  • 4 replies
  • 180 views

nathantrauscht
Semi-Pro II
Forum|alt.badge.img

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?

Best answer by RohitRattan88

Adding a graph extension to your customization project
Event handler code

 

4 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • October 6, 2023

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);
}
}

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • October 6, 2023

@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?

 


RohitRattan88
Acumatica Moderator
Forum|alt.badge.img+4
  • Acumatica Moderator
  • Answer
  • October 6, 2023
Adding a graph extension to your customization project
Event handler code

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img
  • Author
  • Semi-Pro II
  • October 6, 2023

@Zoltan Febert

@RohitRattan88 

Worked perfectly, thank you!