Solved

Display Vendor Contacts as Selector in the PO

  • 7 November 2023
  • 3 replies
  • 79 views

Userlevel 1
Badge

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!

icon

Best answer by jinin 8 November 2023, 18:34

View original

3 replies

Userlevel 7
Badge +4

Hi @Shurtugal98,

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

Userlevel 7
Badge +11

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"/>

 

 

Userlevel 1
Badge

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


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved