Skip to main content
Question

add ship to contact to project

  • April 14, 2026
  • 1 reply
  • 22 views

Forum|alt.badge.img+2

Hi all, i need to add ship to section to project.

I try this

public class ContractExt : PXCacheExtension<Contract>
    {
        public static bool IsActive()
        {
            return true;
        }

        #region UsrShipContactID
        public abstract class usrShipContactID : PX.Data.BQL.BqlInt.Field<usrShipContactID> { }
        [PXDBInt]
        [PXSelector(typeof(PMShippingContact.contactID), ValidateValue = false)]
        [PXUIField(DisplayName = Messages.ShippingContact, Visible = false)]
        [PMShippingContact(typeof(Select2<Customer,
            InnerJoin<PX.Objects.CR.Standalone.Location, On<PX.Objects.CR.Standalone.Location.bAccountID, Equal<Customer.bAccountID>,
                And<PX.Objects.CR.Standalone.Location.locationID, Equal<Customer.defLocationID>>>,
            InnerJoin<Contact, On<Contact.bAccountID, Equal<Customer.bAccountID>,
                And<Contact.contactID, Equal<Customer.defContactID>>>,
            LeftJoin<PMShippingContact, On<PMShippingContact.customerID, Equal<Contact.bAccountID>,
                And<PMShippingContact.customerContactID, Equal<Contact.contactID>,
                And<PMShippingContact.revisionID, Equal<Contact.revisionID>,
                And<PMShippingContact.isDefaultContact, Equal<True>>>>>>>>,
            Where<Customer.bAccountID, Equal<Current<Contract.customerID>>>>), typeof(Contract.customerID))]
        public virtual int? UsrShipContactID { get; set; }
        #endregion
    }
 

 public class ProjectEntryExt : PXGraphExtension<ProjectEntry>
    {
        public static bool IsActive()
        {
            return true;
        }

        #region Select
        [PXViewName(Messages.ShipToContact)]
        public PXSelect<PMShippingContact, Where<PMShippingContact.contactID, Equal<Current<ContractExt.usrShipContactID>>>> ShipTo_Contact;
        #endregion

        #region EventHendlers
        protected virtual void _(Events.RowSelected<PMProject> e, PXRowSelected baseMethod)
        {
            if (baseMethod != null)
            {
                baseMethod(e.Cache, e.Args);
            }

            PMProject row = e.Row;

            if (row == null)
                return;

            bool isProjectEditable = row.IsCompleted != true && row.IsCancelled != true && row.Rejected != true;

            ShipTo_Contact.Cache.AllowUpdate = isProjectEditable;
        }
        #endregion
    }

Add filds on aspx. But my field not populated when i choose customer, and i cannot set override checkbox. I try this example from PM307000 screen.

1 reply

Forum|alt.badge.img+2
  • Jr Varsity I
  • April 14, 2026

Hi ​@bihalivan15 Looks like several things you are missing here:

1) You say you are trying to do this from PM307000 screen, but the graph extension is referencing ProjectEntry, which would be the PM301000 screen.
2) Your custom field appears to have 2 attributes with bql queries: PXSelector and PMShippingContact. There should only be one bql query for a selector field.
3) You have no logic that would cause anything to change when you choose a customer. You could either use the FieldUpdated event handler, or a combination of attributes similar to this:

        [PXDefault(typeof(Search<Customer.defContactID>), PersistingCheck = PXPersistingCheck.Nothing)]
        [PXFormula(typeof(Default<Contract.customerID>))]

If you are hoping to replicate the logic you may also need to implement an address graph extension from one of the out of the box address extensions that are used on other screens, or you will likely need further logic of your own to mimic the override address functionality that you see on other screens.