Skip to main content
Solved

Sales Order - shipping address override


Forum|alt.badge.img

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

Best answer by jinin

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

        }
 

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

4 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • Answer
  • June 21, 2023

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

        }
 


Forum|alt.badge.img

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

 


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 699 replies
  • June 26, 2023

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


Forum|alt.badge.img

Thanks...it worked!


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