Solved

Sales Order - shipping address override

  • 21 June 2023
  • 4 replies
  • 110 views

Userlevel 3
Badge

Hi,

Customer would like to have the Override Address checkbox set to true as the default on the Sale Order.I have not been able to get a customization to work.  Any help would be appreciated.

 

Thanks,

Coleen

icon

Best answer by jinin 21 June 2023, 21:43

View original

4 replies

Userlevel 7
Badge +11

Hi @coleenmcnally22 

If we assign the PXDefault or PXDefaulting event for the override address field, it doesn't work. However, we can write the code in the Customer Field Updated event, and it works.

Please refer to the code snippet below:

  protected void SOOrder_CustomerID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            var row = (SOOrder)e.Row;

            if (Base.Shipping_Address.Select().FirstOrDefault() != null)
            {
                Base.Shipping_Address.Current = Base.Shipping_Address.Select().FirstOrDefault();
                Base.Shipping_Address.Current.OverrideAddress = true;
                Base.Shipping_Address.Update(Base.Shipping_Address.Current);              
            }

        }
 

Userlevel 3
Badge

So the code above will the override default as always true on the address tab on the SO?

 

Userlevel 7
Badge +11

Yes @coleenmcnally22 , Once you select the customer, always the checkbox should be true.

Userlevel 3
Badge

Thanks...it worked!

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