Service AX turn off when execute customize code

Hi experts,

I want to customize a function to store my customization number to BankAccountTrans, CustTrans, VendTrans when I post voucher in GL, AR & AP.

So, I create a method bhs_parmPaymentNumber() in class LedgerVoucher

final Num bhs_parmPaymentNumber(Num _num = bhs_paymentNum)

bhs_paymentNum = _num;
return bhs_paymentNum;

And I call it in LedgerJournalCheckPost.postJournal()

But, when I post voucher, the service turn off.

I don’t know anything happened.

Any one help me?

Thank all.

Try by doing a forward compile on LedgerVoucher class, if that doesn’t solve the issue try debugging and find the line of code that is causing the issue. Also look at the event viewer for any related logs.

Hi Kranthi,
Thank for your rep.
I compiled and debugging, and the line of code that causing the issue is “bhs_paymentNum = _num;” in method bhs_parmPaymentNumber.
I am trying build CIL to solve this issue.

Compile forward?

I have not yet compiled forward, but I built full CIL. Does it have any effect?

You should try by doing the compile forward.

I tried and successfully.
Thanks all.