Skip to main content
Solved

Display Vendor Contacts as Selector in the PO


Forum|alt.badge.img

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
    [PXDBInt]
    [PXUIField(DisplayName = "Vendor Contact")]
    [PXSelector(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!

Best answer by jinin

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
        [PXDBInt]
        [PXUIField(DisplayName="Contact")]
        [PXSelector(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"/>

 

 

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

Vignesh Ponnusamy
Acumatica Moderator
Forum|alt.badge.img+5

Hi @Shurtugal98,

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


jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • November 8, 2023

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
        [PXDBInt]
        [PXUIField(DisplayName="Contact")]
        [PXSelector(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"/>

 

 


Forum|alt.badge.img

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


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