Skip to main content

Hello Everyone,

 

We have a requirement to load the SHIP-TO Address from the employee by default instead of Shipping destination type details.

 

We have used fielddefaulting event, but it is not assigning the employee address on page load.

We have tried fieldupdating event and we are able to override the address when we update creator, but we are getting a weire issue, i.e., When we complete  removehold process and once we reload the page then again the address is reverting back to the default ship to address instead of employee address.

 protected virtual void RQRequisition_EmployeeID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated baseEvent)
{
baseEvent?.Invoke(sender, e);
RQRequisition row = e.Row as RQRequisition;
if (row == null) return;
if (Base.Document.Current != null)
{
BAccount BaccDetail = PXSelect<BAccount, Where<BAccount.bAccountID, Equal<Required<BAccount.bAccountID>>>>.Select(Base, row.EmployeeID);
if (BaccDetail != null)
{
Address addressdetail = PXSelect<Address, Where<Address.addressID, Equal<Required<Address.addressID>>>>.Select(Base, BaccDetail.DefAddressID);
if (Base.Shipping_Address.Current != null && addressdetail != null)
{
Base.Shipping_Address.Current.OverrideAddress = true;
Base.Shipping_Address.Current.AddressLine1 = addressdetail.AddressLine1;
Base.Shipping_Address.Current.AddressLine2 = addressdetail.AddressLine2;
Base.Shipping_Address.Current.City = addressdetail.City;
Base.Shipping_Address.Current.State = addressdetail.State;
Base.Shipping_Address.Current.CountryID = addressdetail.CountryID;
Base.Shipping_Address.Current.PostalCode = addressdetail.PostalCode;
}
}
}
}

 

We tried to use shipping destination type to add new option as an employee but didn’t find how to do it as all the SHIP TO panel fields contains attributes which are refereing from location, address, poaddress tables to load the default data in screen. Can anyone provide the approach to override these attributes without deviating acumatica ship to functionality. 

What is the best way to show the employee address by default?

Thanks,

 

 

Be the first to reply!

Reply