Search code examples
importaxaptax++dynamics-ax-2012dynamics-ax-2012-r2

How to validate LedgerJournal from code?


I'm inserting o LedgerJournal from code.

When I finished to insert a record in tables LedgerJournalTable and LedgerJournalTrans I have to validate and post this Journal.

For to post a Ledger I use the class LedgerJournalPost , my code is :

LedgerJournalPost::postJournal(_myJournal , NoYes::NO);

This way is good to post, but before I want to validate the journal.

What is the class ? Or what is the good way ?

On LedgerForm there is a Validate Button , under I have this MenuItem : LedgerJourChk (Label:Validate), but I don't find the class.

Thanks all,

enjoy!!


Solution

  • The reason you can't find the class is because the form method \Forms\LedgerJournalTable\Methods\enableButtonsActive is where they set the menu item to use in a line similar to checkJournal.menuItemName(menuitemActionStr(LedgerJourChkLJTransCustPaym));

    You would use one of the classes LedgerJournalCheck or LedgerJournalCheckPost.

    See this accepted answer to see an example use:

    https://stackoverflow.com/a/6873379/1179573