Skip to main content
Solved

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


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+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?

Best answer by RohitRattan88

Adding a graph extension to your customization project
Event handler code

 

View original
Did this topic help you find an answer to your question?

4 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+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);
    }
}

 


nathantrauscht
Semi-Pro II
Forum|alt.badge.img+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?

 


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

 


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

@Zoltan Febert

@RohitRattan88 

Worked perfectly, thank you!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings