Skip to main content

Hi, I am new to Acumatica and just did the T200 and T210 Training. 

 

My customer needs a field that shows all the Vendor Contacts in a Selector (like e.g. when choosing the Vendor in a new PO). 
From here: 

So tried building a field that builds a selector in the POOrderExt of the POOrder DAC. Unfortunately nothing works out for me. I tried it with the following code so far:
 

    #region UsrVendorContacts
    rPXDBInt]
    ]PXUIField(DisplayName = "Vendor Contact")]
    aPXSelector(typeof(Search<Contact.contactID,
        Where<Contact.bAccountID, Equal<Current<POOrder.vendorID>>>>),
        SubstituteKey = typeof(Contact.displayName),
        DescriptionField = typeof(Contact.phone1),
        Filterable = true)]
public virtual int? UsrVendorContacts { get; set; }
public abstract class usrVendorContacts : PX.Data.BQL.BqlInt.Field<usrVendorContacts> {}
#endregion

I also checked the datatypes which seem to be int just as my custom field. I also used foreign keys and checked in a GI if there is matching data.

Help would be greatly appreciated!

Hi @Shurtugal98,

Can you please elaborate the requirements? Do you want to add the Vendor Contacts to which screen(share the screenID and name)?


Hi @Shurtugal98 ,

 I assume that you want to showcase the contact details on the Purchase order screen based on the vendor. 

Here is the Sample code:

DAC:

public class POOrderExt : PXCacheExtension<PX.Objects.PO.POOrder>
    {
        #region UsrContact
        rPXDBInt]
        IPXUIField(DisplayName="Contact")]
        CPXSelector(typeof(Search<Contact.contactID, Where<Contact.bAccountID, Equal<Current<POOrder.vendorID>>>>),
        SubstituteKey = typeof(Contact.contactID),DescriptionField = typeof(Contact.displayName),  Filterable = true)]
        public virtual int? UsrContact { get; set; }
        public abstract class usrContact : PX.Data.BQL.BqlInt.Field<usrContact> { }
        #endregion
    }

------------------------------------------------------------------------------

Aspx:
    <px:PXSelector runat="server" ID="CstPXSelector1" DataField="UsrContacts" AutoRefresh="true" CommitChanges="true"/>

 

 


Hi @jinin
this worked like a charm! I was going crazy over here thinking i made everything right. Didn’t realize i put too little attention to the SubstituteKey and messed that up. Thank you so much! To you as well @Vignesh Ponnusamy for taking the time! 


Reply