Is there an easy way to get the Project Address to auto-populate with the Default Location (the shipping Location ID specified on the Opportunity)?

Is there an easy way to get the Project Address to auto-populate with the Default Location (the shipping Location ID specified on the Opportunity)?
Best answer by Naveen Boga
Hi
Hope this helps!!
public class ProjectEntryExt : PXGraphExtension<ProjectEntry>
{
protected virtual void _(Events.FieldUpdated<PMProject, PMProject.locationID> e, PXFieldUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(e.Cache, e.Args);
PMProject row = e.Row as PMProject;
if (row != null)
{
Address objAddress = PXSelectJoin<Address, InnerJoin<Location, On<Location.bAccountID, Equal<Address.bAccountID>,
And<Location.defAddressID, Equal<Address.addressID>>>>,
//Where<Address.bAccountID, Equal<Required<Address.bAccountID>>,
Where<Location.locationID, Equal<Required<Location.locationID>>>>.Select(Base, /*row.CustomerID,*/ row.LocationID);
if (objAddress != null)
{
if (Base.Site_Address.Current != null)
{
Base.Site_Address.Current.AddressLine1 = objAddress.AddressLine1;
Base.Site_Address.Current.AddressLine2 = objAddress.AddressLine2;
Base.Site_Address.Current.City = objAddress.City;
Base.Site_Address.Current.State = objAddress.State;
Base.Site_Address.Current.CountryID = objAddress.CountryID;
Base.Site_Address.Current.PostalCode = objAddress.PostalCode;
}
}
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.