Skip to main content
Solved

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

  • May 13, 2024
  • 2 replies
  • 190 views
  • Translate All

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

 

View original

2 replies

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+4

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

 

Translate

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

Translate