How to: Update production order status through X++
Good day everyone. Continuing from my post How to: Create Production Order through X++.
This time I would like to show a simple code which change the production order status to StartedUp, going through Estimation, Schedule operation, Schedule Work and Release. Depending how you have set up the production parameters it’s possible to consume BOM and Route automatically creating picking list and route card.
For example, I will use the production order created on my other post.
Now, create a new Job and paste the code below and execute it:
static void autoUpdate(Args _args) { ProdTable prodTable = ProdTable::find('P000172'); prodTable.autoUpdate(ProdStatus::StartedUp); }
IMPORTANT: The method autoUpdate() only works until StartedUp status, it means you can’t use it to update the production order to Reported As Finished or to Completed.
After the execution I got the following Infolog:
On production parameters I had set to consume BOM automatically, as a result the picking list has been created and posted automatically. It also has created a Route Card Journal.
Finally, you can see that the production status has been set to Started and Remain Status has changed to Route consumption.

This was originally posted here.
*This post is locked for comments