Skip to main content
Answer

How to set a Sales Order custom field after Customer is selected

  • May 13, 2024
  • 2 replies
  • 119 views

Hello everyone,

The goal is to set a custom field simultaneously when the Shipping information of the Sales Order is populated upon selecting the Customer.

I tried to accomplish this through customization, but unfortunately, I'm unable to locate the correct method name for capturing the moment when the Customer information is integrated into the Sales Order.

Appreciate any assistance!

Best answer by Zoltan Febert

Hi @marceloquevedo,

Usually I do it in a RowUpdated event handler, but you can try FieldUpdated as well.

protected virtual void _(Events.RowUpdated<SOOrder> e)
{
if (e.Row == null || Equals(e.Row.CustomerID, e.OldRow?.CustomerID)) return;

var rowExt = e.Row.GetExtension<YourSOOrderExtension>();
rowExt.UsrYourField = "value";
}

 

2 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • Answer
  • May 13, 2024

Hi @marceloquevedo,

Usually I do it in a RowUpdated event handler, but you can try FieldUpdated as well.

protected virtual void _(Events.RowUpdated<SOOrder> e)
{
if (e.Row == null || Equals(e.Row.CustomerID, e.OldRow?.CustomerID)) return;

var rowExt = e.Row.GetExtension<YourSOOrderExtension>();
rowExt.UsrYourField = "value";
}

 


Thank you @Zoltan Febert I think that is exactly what I needed!