How can I add additional columns to the Reference Nbr. column selector?
I went through the process of creating the customization project and then added AP.APAdjust. I clicked on Selector Columns and then added APAdjust__vendorID and APPayment__extRefNbr.
I saved the changes and published the customization but when viewing the selector within the detail grid of AP503000 I did not see the columns that I added.
Just in case, I also replaced the attributes of the APAdjust VendorID column from
@ddunn please elaborate your question in more descriptive manner, the screen you mentioned here is process screen and there are two vendor fields available here,one is in header and another in in lines. What are you trying to achieve …?
Hi @KishoK - thanks for looking at my question!
In the detail grid of AP503000 is the Reference Nbr. column with a selector. If I want to manually add a document for payment to this grid I’ll use the selector on that column to locate a document. However, the selector fields are missing some columns to help the user know which documents to select. I’d like to add the Vendor ID and Vendor Name to the fields displayed.
Hi @ddunn,
As you need to add “Vendor ID” and “Vendor Name” fields to the Ref Nbr selector in the Documents TO PAY tab, the below article is well explained how to add the fields to the Selector without any code changes. Please find the link below.
Hi @ddunn Seems the Acumatica’s recommended standard method mentioned above won’t work in this case, the attributes of the Reference Nbr are already overode in the graph which has its own Search2<> BQL statement, So your best bet is overide the attributes again in Graph extension, here comes the tricky part even if you overide all the attributes using cache attached method, use of APInvoiceType.AdjdRefNbr attribute won’t yield you any difference since the selector columns already defined in the attribute level, So to achieve your desired output you need to create your own Selector attribute. Follow the code attached below
using System;
using PX.Common;
using PX.Data; using PX.Data.BQL; using PX.Data.EP;
using PX.Objects.GL; using PX.Objects.CM; using PX.Objects.CS; using PX.Objects.TX; using PX.Objects.CR; using PX.Objects.AP; using PX.Objects.CA; using CRLocation = PX.Objects.CR.Standalone.Location; using PX.Data.ReferentialIntegrity.Attributes; using PX.Objects.AP.MigrationMode; using PX.Objects.AR; using PX.Objects.Common.Attributes; namespace T_Project { public class CustAdjdRefNbrAttribute : PXSelectorAttribute { public CustAdjdRefNbrAttribute(Type SearchType) : base(SearchType, typeof(APRegister.branchID), typeof(APRegister.refNbr), typeof(APRegister.docDate), typeof(APRegister.finPeriodID), typeof(APRegister.vendorLocationID), typeof(APRegister.curyID), typeof(APRegister.curyOrigDocAmt), typeof(APRegister.curyDocBal), typeof(APRegister.status), typeof(APAdjust.APInvoice.dueDate), typeof(APAdjust.APInvoice.invoiceNbr), typeof(APRegister.docDesc), typeof(APRegister.vendorID), typeof(APRegister.vendorID_Vendor_acctName)) { }
I created a project called T_Project and copied the system standard AdjdRefNbr attribute to a newly created CustAdjdRefNbr attribute and did some changes in selector columns (Added vendor ID and Vendor_acctName), once you done with this you can override the whole attributes in graph extension. Follow the attached code below
using System.Diagnostics; using PX.Objects.Common.MigrationMode; using PX.Objects.AR; using PX.Objects.TX; using PX.Objects.AP.Standalone; using PX.Objects.GL.FinPeriods.TableDefinition; using PX.Data.ReferentialIntegrity.Attributes;
using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Web; using PX.Data; using PX.Objects.CR; using PX.Objects.GL; using PX.Objects.CM; using PX.Objects.CA; using PX.Objects.Common; using PX.Objects.Common.Extensions; using PX.Objects.CS; using PX.Objects.AP.MigrationMode; using PX.Objects.Common.Utility; using PX.Objects.GL.FinPeriods; using PX.Objects; using PX.Objects.AP; using T_Project;
namespace PX.Objects.AP { public class APPayBills_Extension : PXGraphExtension<APPayBills> { #region Event Handlers
here I made the reference of my project and applied the newly created attribute CustAdjdRefNbr instead of APInvoice.AdjdRefNbr, now publish the project with these two code files to make the reference number selector display Vendor ID and Name
@KishoK - Amazing! Thank you!
@KishoK - I have your solution working in 2020R2 but in 2021R1 it doesn’t work. I made a slight adjustment to the Display Name on the column header to confirm that the overridden attributes are being loaded in the _CacheAttached event. I also recopied the Search2<> BQL command of the APInvoiceType.AdjdRefNbr attribute because it has changed in 2021R1.
I’ve tried adding nPXMergeAttributes(Method = MergeMethod.Merge)] but that didn’t to work.
Any suggestions?
public class APPayBills_Extension : PXGraphExtension<APPayBills>
{
//Customer selector field attribute
public class CustAdjdRefNbrAttribute : PXSelectorAttribute
@ddunn - Wow...seems Acumatica wanted to give hard time to you just joking, In 2021 R1 Acumatica again overrode the attributes in one more graph extension called APPayBillsVisibilityRestriction this is a visibility restriction extension,which is wired with the below configuration option (refer pic)
if you disable this configuration your vendor related details will be visible in the selector, if enable those details will be hidden. So its up to you how you going to handle it, Still you want the Customer and Vendor visiblity restriction need to be enforced and show the vendor details only in the Prepare Payment screen then extend the Primary Graph + APPayBillsVisibilityRestriction Graph Extension in the manner of E2 : PXGraphExtension<E1,PrimaryGraph> Use the below code public class APPayBills_Extension : PXGraphExtension<APPayBillsVisibilityRestriction, APPayBills> { }
Regards
Thank you again, @KishoK - you’ve been very helpful in tracking all of this down!