Search code examples
acumatica

Error: An error occurred during processing of the field Account Number: Error: 'Account Number' cannot be found in the system


The field that needs to save the record ID has an issue with resolving the autonumbering.

The DAC is set up to use autonumbering. However, when searching for a record or creating a new record, I get a 'The item AcctCD is not found (restricted:False,external:True,value: )' error

DAC:


    [SerializableAttribute()]
    [PXPrimaryGraph(typeof(LoanMaint))]
    [PXCacheName("OLAccount")]
    public class OLAccount : IBqlTable
    {   
 [PXDBString(30, IsKey = true, IsUnicode = true, InputMask = ">CCCCCCCCCCCCCCC")]
        [PXDefault()]
        [PXUIField(DisplayName = "Loan Number", Visibility = PXUIVisibility.SelectorVisible, TabOrder = 1)]
        [PXSelector(typeof(Search<OLAccount.acctCD>))]
         [LoanAccount.RefNbr(typeof(Search2<OLAccount.acctCD, 
                                      InnerJoin<BAccountR, On<OLAccount.parentBAccountID, Equal<BAccountR.bAccountID>>>>), 
                                      Filterable = true, IsPrimaryViewCompatible = true)]       
        [LoanAccount.Numbering()]
        public virtual string AcctCD { get; set; }
        public abstract class acctCD : PX.Data.BQL.BqlString.Field<acctCD> { }
}

public class LoanAccount
    {
        /// <summary>
        /// Specialized selector for OLAccount AcctCD.<br/>
        /// By default, defines the following set of columns for the selector:<br/>
        /// OLAccount.acctCD, OLAccount.acctName, OLAccount.externalAccountRef, <br/>
        /// OLAccount.externalReference, OLAccount.parentBAccountID<br/>
        /// </summary>
        public class RefNbrAttribute : PXSelectorAttribute
        {
            public RefNbrAttribute(Type SearchType)
                : base(SearchType,
                typeof(OLAccount.acctCD),
                typeof(OLAccount.acctName),
                typeof(OLAccount.externalAccountRef),
                typeof(OLAccount.parentBAccountID),
                typeof(BAccountR.acctCD),
                typeof(BAccountR.acctName),
                typeof(BAccountR.type),
                typeof(BAccountR.classID))
            {
            }
        }

        public class NumberingAttribute : AutoNumberAttribute
        {
            public NumberingAttribute()
                : base(typeof(OLSetup.accountNumberingID), typeof(AccessInfo.businessDate)) { }

        }
    }

Graph:

public class LoanMaint : PXGraph<LoanMaint, OLAccount>
    {
        public PXSelect<OLAccount> LoanAccount;
        public PXSelect<OLAccount, Where<OLAccount.acctCD, Equal<Current<OLAccount.acctCD>>>> CurrentLoanAccount;

        public PXSetup<Company> Company;
        public PXSetup<OLSetup> OLSetup;

        public LoanMaint()
        {
            OLSetup setup = OLSetup.Current;
        }
    }

Error screen on system


Solution

  • The issue was resolved by removing ReferentialIntegrity Attributes, refer to link form more information: https://asiablog.acumatica.com/2016/08/using-of-pxrestrictorattribute.html, the same error I was getting for no reason: It gives the uninformative message cannot be found in the system if a record with a given key does not meet the selector condition