Posting a ProdTableJournal programmatically.

I am creating picking journals in the ProdTableJournal table, and am trying to post them from code. My issue is that the code I’m using to do this seems to assume that I’m going to be doing this from a form. Is there a correct way to post this programmatically that I am not seeing? Thanks.

ProdJournalTable journal;

Args args = new Args();

ProdJournalCheckPost journalCheckPost;

;

args.record(journal);

journalCheckPost = ProdJournalCheckPostBom::newJournalCheckPost(true, false, args.parmEnum(), journal.TableId, journal.JournalId);

journalCheckPost.run();

The Picking List Journal will be created by the system when you start the production based on the parameter setup.

so i don’t understand your requirement of creating a Picking List Journal by using x++.

There is an option in production for automatically posting the Picking List Journal when production order is started.

Here is code which will change the status of the production order to Started

http://kranthiax.blogspot.com/2010/11/changing-production-order-status-to.html

The situation is a strange one, but what it comes down to is that the customer wants existing, but un-posted picking journals to be posted automatically under certain situations. In the end, I modified the ProdTableJournal form itself so that when it’s run with a particular constant as its parm() value, it will take the ProdTableJournal record that its handed and silently post it via the Action menu item ProdJournalPost.

It’s a little bit messy, but it doesn’t seem like AX was intended to post picking journals through code like what I’m having to do, and this way I’m not recreating any existing functionality.

Not knowing what the certain circumstances are this is difficult to comment on this is education or training, but it is common for solutions to be developed for standard functionality in the Dynamics world.

Below is the Code to POST already created Picking List of Production Order…

static void PostPickingListExecute()
{

ProdJournalTable journalTable;
ProdId _prodId ;
ProdJournalCheckPostBOM prodJournalCheckPostBOM;
;

select journalTable where journalTable.ProdId == _prodId && journalTable.JournalType == ProdJournalType::Picklist;

prodJournalCheckPostBOM = ProdJournalCheckPostBOM::newPostJournal(journalTable.JournalId,true);

prodJournalCheckPostBOM.parmThrowCheckFailed(false);

prodJournalCheckPostBOM.run();
}