Dynamics AX 2012 R3 I am creating records in the table LedgerJournalTrans in a program. This is creating a 'Vendor payment' journal.
I just open the form, and for the records that I create, in the form LedgerJournalTransVendPaym gives this warning: Voucher CNCRPAY-000007 cannot be changed or deleted when a check has been printed.This is on the initial opening of the record.
This is being generated by the leaveRecord() method on the data source.
If I press CTRL-F5 (Restore), I can get past this error.
I cannot figure out why the form thinks the record needs to be written when first opened.Anyone else seen or experience this behavior?
DavidMunn said:I am creating records in the table LedgerJournalTrans in a program.
What does that mean? Are you creating it through custom code?
Please provide details.
Yes, it is custom code. I have created journals before , but have never had this problem. The one thing that is different, is that I am attaching (marking) records to the journal.
# manager = CustVendOpenTransManager::construct(originator); # manager.updateTransMarked(vendTransOpen, NoYes::Yes);
Then create a check, but I do not want it to print.
# custVendOutPaym.open(); # custVendOutPaym.generatePaymentLines(); # //custVendOutPaym.close(); // This is what prints the check. We don't want to.
This is all working, except when I open the journal, I have to CTRL-F5 in order to edit the record, or even exit. I am just trying to figure out what step I might be missing. I am looking at the actual print process (VendOutPaym_Cheque) to see if anything in the CustVendOutPaym.Close() method that I am skipping might be the cause.
Thank you for taking the time to investigate this with me. Since I do have a work around, I will just let the user know that they have to Restore (Ctrl-F5) the record when presented with this error. Other journals that are unposted, will show this error once, and then I can continue. It appears that the validate write has a catch method that is being fired that resets the record.
I have other tasks to complete so I do not have more time to check further.