Payment Journal problem

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?

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.

It would be difficult to answer your question, without knowing - what is your code and what it does exactly?

  • The customer is using a payment service.
  • They send a file of ‘Invoices’ paid to a vendor, including a check number.
  • I create a payment journal, marking the invoices to be paid.
  • If the total of the invoices reported matches the check amount, I want to ‘Attach’ that check number to the marked records.

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.

The error is generated from the below code. Try to trace the issue from there,
Tables\LedgerJournalTrans\Methods\checkAllowEditWhenCheckPrinted

I know that is the source of the error. I want to know why, when I open the record, it is throwing this error. If I CTRL-F5 (Restore) without changing anything, I can exit. The record has not been modified and should not be marked as dirty when I first open the form.

You should be debugging to know the issue. I am unable to reproduce your scenario.

May be it could be an issue with the cache that is used in different methods,
checkAllowEdit, cacheAllowEdit. Debugging will give you much more details of the issue.

Kranthi,

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.

Thanks again.