Skip to main content
Question

Exception in ARReleaseProcess for Custom DocType (AdjdRefNbr selector validation)

  • January 6, 2026
  • 0 replies
  • 14 views

Forum|alt.badge.img+2

I have introduced a new custom AR Document Type.

I am encountering an issue during the release process within the ARReleaseProcess graph. Specifically, the standard method CreateSelfApplicationForDocument fails when trying to insert an ARAdjust record for my custom document type.

Here is the standard code logic where the error occurs:
public virtual ARAdjust CreateSelfApplicationForDocument(ARRegister doc)
{
    ARAdjust aRAdjust = new ARAdjust();
    aRAdjust.AdjgDocType = doc.DocType; // My Custom DocType
    aRAdjust.AdjgRefNbr = doc.RefNbr;
    aRAdjust.AdjdDocType = doc.DocType; // My Custom DocType
    aRAdjust.AdjdRefNbr = doc.RefNbr;   // Error occurs validating this
    // ... setting other fields ...
    aRAdjust.Released = false;
    
    // The error happens on this line:
    return (ARAdjust)ARAdjust_AdjgDocType_RefNbr_CustomerID.Cache.Insert(aRAdjust);
}
 

The Issue: When Cache.Insert(aRAdjust) is called, I get a PXSetPropertyException stating that the AdjdRefNbr cannot be found.

It seems the selector on AdjdRefNbr does not recognize my new custom DocType, even though the record exists in ARRegister.

What I have tried: I attempted to extend the ARAdjust DAC to include my new custom Document Type in the AdjdDocType list, hoping this would allow the validator to proceed. Here is my extension:

public class ARAdjustExt : PXCacheExtension<ARAdjust>
{
    #region AdjdDocType
        [PXDBString(3, IsKey = true, IsFixed = true, InputMask = "")]
        [PXDefault(ARDocType.Invoice, PersistingCheck = PXPersistingCheck.Nothing)]
        [PXUIField(DisplayName = PX.Objects.AR.Messages.DocType, Visibility = PXUIVisibility.Visible)]
        [ARInvoiceTypeExt.AdjdList]
        public string AdjdDocType { get; set; }
        public abstract class adjdDocType : PX.Data.BQL.BqlString.Field<adjdDocType> { }
        #endregion
}

However, this did not solve the issue. The AdjdRefNbr field (which uses the [ARInvoiceType.AdjdRefNbr] attribute in the base code) still fails validation.

For reference, here is the Data View used in the release process:
public PXSelectJoin<ARAdjust, 
    InnerJoin<PX.Objects.CM.Extensions.CurrencyInfo, 
        On<PX.Objects.CM.Extensions.CurrencyInfo.curyInfoID, Equal<ARAdjust.adjdCuryInfoID>>, 
    InnerJoin<PX.Objects.CM.Extensions.Currency, 
        On<PX.Objects.CM.Extensions.Currency.curyID, Equal<PX.Objects.CM.Extensions.CurrencyInfo.curyID>>, 
    InnerJoin<ARRegister, 
        On<ARRegister.docType, Equal<ARAdjust.adjdDocType>, 
        And<ARRegister.refNbr, Equal<ARAdjust.adjdRefNbr>>>, 
    LeftJoinSingleTable<ARInvoice, 
        On<ARInvoice.docType, Equal<ARAdjust.adjdDocType>, 
        And<ARInvoice.refNbr, Equal<ARAdjust.adjdRefNbr>>>, 
    LeftJoinSingleTable<ARPayment, 
        On<ARPayment.docType, Equal<ARAdjust.adjdDocType>, 
        And<ARPayment.refNbr, Equal<ARAdjust.adjdRefNbr>>>, 
    LeftJoin<ARTran, 
        On<ARRegister.paymentsByLinesAllowed, Equal<True>, 
        And<ARTran.tranType, Equal<ARAdjust.adjdDocType>, 
        And<ARTran.refNbr, Equal<ARAdjust.adjdRefNbr>, 
        And<ARTran.lineNbr, Equal<ARAdjust.adjdLineNbr>>>>>, 
    LeftJoin<CurrencyInfo2, 
        On<CurrencyInfo2.curyInfoID, Equal<ARRegister.curyInfoID>>>>>>>>>
    , Where<ARAdjust.adjgDocType, Equal<Required<ARAdjust.adjgDocType>>, 
        And<ARAdjust.adjgRefNbr, Equal<Required<ARAdjust.adjgRefNbr>>, 
        And<Where<Switch<Case<Where<Required<ARAdjust.released>, Equal<True>>, 
            IIf<Where<ARAdjust.adjNbr, Equal<Required<ARAdjust.adjNbr>>>, True, False>>, 
            IIf<Where<ARAdjust.released, NotEqual<True>>, True, False>>, Equal<True>>>>>, 
    OrderBy<Asc<ARAdjust.adjdDocType, 
        Asc<ARAdjust.adjdRefNbr, 
        Asc<ARAdjust.adjdLineNbr>>>>> ARAdjust_AdjgDocType_RefNbr_CustomerID;

Do I need to override the attributes on AdjdRefNbr in ARAdjust as well? The base attribute seems to have hardcoded validation that ignores my custom DocType extension. If so, what is the best approach to redefine the AdjdRefNbr selector to accept a custom type without breaking standard functionality?

Any advice would be appreciated. Thank you!