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))
{
}
protected override bool IsReadDeletedSupported => false;
}
}
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
//[key] Reference number of the adjusted document.
/// </summary>
[PXDBString(15, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
[PXDefault()]
[PXUIField(DisplayName = "Reference Nbr.", Visibility = PXUIVisibility.Visible)]
[CustAdjdRefNbr(typeof(Search2<
APInvoice.refNbr,
InnerJoin<BAccount,
On<BAccount.bAccountID, Equal<APInvoice.vendorID>,
And<Where<
BAccount.status, Equal<BAccount.status.active>,
Or<BAccount.status, Equal<BAccount.status.oneTime>>>>>,
LeftJoin<APAdjust,
On<APAdjust.adjdDocType, Equal<APInvoice.docType>,
And<APAdjust.adjdRefNbr, Equal<APInvoice.refNbr>,
And<APAdjust.released, Equal<False>,
And<Where<
APAdjust.adjgDocType, NotEqual<Current<APPayment.docType>>,
Or<APAdjust.adjgRefNbr, NotEqual<Current<APPayment.refNbr>>>>>>>>,
LeftJoin<APPayment,
On<APPayment.docType, Equal<APInvoice.docType>,
And<APPayment.refNbr, Equal<APInvoice.refNbr>,
And<APPayment.docType, Equal<APDocType.prepayment>>>>>>>,
Where<
APInvoice.docType, Equal<Optional<APAdjust.adjdDocType>>,
And2<Where<
APInvoice.released, Equal<True>,
Or<APInvoice.prebooked, Equal<True>>>,
And<APInvoice.openDoc, Equal<True>,
And<APAdjust.adjgRefNbr, IsNull,
And<APPayment.refNbr, IsNull>>>>>>),Filterable = true)]
protected virtual void APAdjust_AdjdRefNbr_CacheAttached(PXCache cache)
{
}
#endregion
}
}
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