Acumatica 无法将扩展字段设置为新创建对象的Ref Nbr

Acumatica 无法将扩展字段设置为新创建对象的Ref Nbr,acumatica,Acumatica,在“现金销售”页面上,我正在覆盖“发布”按钮,为正在创建的记录创建第二个日记账事务,该事务将根据屏幕上的某些信息对现金账户进行调整。我的流程运行正常,成功创建了新的日记账事务,但当它在“现金销售”页面上设置扩展字段,然后执行“发布”按钮的基本操作时,我收到一条错误消息,说明: 错误:处理字段资金批次值GLHW016312时出错错误:系统中找不到资金批次“GLHW016312” 执行该过程的代码如下所示: public delegate IEnumerable ReleaseDelegate(PX

在“现金销售”页面上,我正在覆盖“发布”按钮,为正在创建的记录创建第二个日记账事务,该事务将根据屏幕上的某些信息对现金账户进行调整。我的流程运行正常,成功创建了新的日记账事务,但当它在“现金销售”页面上设置扩展字段,然后执行“发布”按钮的基本操作时,我收到一条错误消息,说明:

错误:处理字段资金批次值GLHW016312时出错错误:系统中找不到资金批次“GLHW016312”

执行该过程的代码如下所示:

public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
    //Journal Transaction uses batch number
    if (Base.CurrentDocument.Current.ExtRefNbr != null && Base.CurrentDocument.Current.ExtRefNbr != string.Empty)
    {
        if (GLSetup.Current.GetExtension<GLSetupExt>().UsrCreateFundEntry == true)
        {
            if (CFBSAdjustments.Select().Count > 0)
            {
                Customer customer = PXSelect<Customer, Where<Customer.bAccountID, Equal<Current<Customer.bAccountID>>>>.Select(Base);
                JournalEntry graph = PXGraph.CreateInstance<JournalEntry>();
                Batch batch = graph.BatchModule.Insert();
                batch.Description = "Fund Entry for Cash Sales Reference " + Base.CurrentDocument.Current.RefNbr;
                decimal? debit = 0;
                decimal? credit = 0;
                foreach (CFBSCashSalesAdjustment row in CFBSAdjustments.Select())
                {
                    GLTran tran = graph.GLTranModuleBatNbr.Insert();
                    tran.AccountID = row.Account;
                    tran.SubID = row.Subaccount;
                    tran.DebitAmt = row.DebitAmt;
                    tran.CuryDebitAmt = row.DebitAmt;
                    debit += row.DebitAmt;
                    tran.CreditAmt = row.CreditAmt;
                    tran.CuryCreditAmt = row.CreditAmt;
                    credit += row.CreditAmt;
                    tran.RefNbr = row.CashSalesRefNbr;
                    tran.TranDesc = customer.AcctCD + " - " + customer.AcctName;
                    graph.GLTranModuleBatNbr.Update(tran);
                }

                batch.CreditTotal = credit;
                batch.CuryCreditTotal = credit;
                batch.DebitTotal = debit;
                batch.CuryDebitTotal = debit;
                batch = graph.BatchModule.Update(batch);
                graph.Actions.PressSave();

                if (GLSetup.Current.GetExtension<GLSetupExt>().UsrAutoRelease == true)
                {
                    graph.BatchModule.Current.Hold = false;
                    graph.release.Press();
                }

                Base.Document.Current.GetExtension<ARRegisterExt>().UsrFundBatch = batch.BatchNbr;
                Base.Actions.PressSave();
            }
        }
    }
    return baseMethod(adapter);
}
调试后,我发现错误发生在返回baseMethodadapter行的过程中

奇怪的是,如果我在错误上单击OK,然后再次单击Release,它将正常运行,没有任何错误,创建两个记录,并将定制记录设置为扩展字段

首次发布,错误:

第二次发布,成功添加到标题的参考编号链接:

从图片中可以看出,成功创建日记账分录时的批次号与错误号不同。它确实创建了两次记录


对于扩展字段,我将其设置为一个选择器,启用=false,允许编辑=true以生成链接。

如果用户从未直接填充过扩展字段,您可以尝试删除该选择器。或者尝试在选择器中指定ValidateValue=false。

我使用选择器的唯一原因是可以直接链接到所看到的记录。除了选择器之外,还有其他方法可以用来创建指向记录的链接吗?就是这样,非常感谢!我想我记得我需要一个完全不同的解决方案,只是忘记了选择器中的ValidateValue=false选项。