Search code examples
axaptadynamics-ax-2012x++journal

How to post Production journal table from code?


I create from code the record in two tables ProdJournalTable (header) and ProdJournalProd (lines).

I inserted all records in both tables well, without problems.

After that I want to to post this Journal.

I used this code:

ProdJournalCheckPostProd::newPostJournal(myProdJournalProd.JournalId, true);    

I execute the method, but in fact not register the journal, in Form Production journal my record have yet to be registered. I call the class under the button in the Form, certainly not good. If I clicked on button I post the journal without problem.

The Journal and the form is in :

Production control -> Journals -> Report as Finished

I'm writing this Journal Report as Finished.

How do you post from code?


Solution

  • The newPostJournal methods returns a ProdJournalCheckPostProd object. It does not post the journal.

    If you really want to post the journal, call the run method.

    ProdJournalCheckPostProd::newPostJournal(myProdJournalProd.JournalId, true).run();