Skip to main content
Solved

Can you configure the system to carry the Default Location from an Opportunity through to the Project Address on a Project?


cwalton3
Freshman II

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 @cwalton3   Here is the customization code. Please add this to package package and deploy. 

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

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

5 replies

Forum|alt.badge.img+4

Do you have access to a developer resource?  If the business case is approved for development, they should be able to add a FieldUpdated event handler (into a customization project) on the location field to lookup the address information of the location and push it into the project address.  I’m not sure of any other ways this could be done “in-line” during data entry.


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • Answer
  • July 27, 2021

Hi @cwalton3   Here is the customization code. Please add this to package package and deploy. 

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


cwalton3
Freshman II
  • Author
  • Freshman II
  • 10 replies
  • July 29, 2021

@brianstevens  @Naveen B I wanted to thank you both for your responses. both were very helpful as a non-developer/techno-functional consultant. 


KellyBurns74
Freshman I
Forum|alt.badge.img

Does anyone know why this is not an out-of-the-box function yet?  These fields have been there for a few major versions.  @Naveen Boga thanks for the code, but I hope this is on the roadmap as a default feature when using CRM with Projects.  


Forum|alt.badge.img+1

This is similar to the following.  Please up-vote this idea.  There is in fact a permanent solution coming.

https://community.acumatica.com/ideas/creating-project-from-project-quote-billing-contact-information-from-the-project-quote-should-be-copied-to-project-949

 

On 23R1, please use the work around of selecting the Override option on the Project Quotes form (PM304500) in the Project Address section (see the screenshot below). This will preserve the address and it will be carried on to the project.

screenshot-1.png


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