Good day!
Is there a way to have a batch job that will automate the change of status of completed production orders to finished?
It's currently taking around 5 mins to change a status for an order and I would like to improve that process.
In that case you can create a Codeunit and enter the below code for that:
ProductionOrder.SETRANGE(Status,ProductionOrder.Status::Released);
ProductionOrder.SETRANGE("No.",'RPO/2013/001001','RPO/2013/31090');
ProductionOrder.SETRANGE("Assigned User ID",'SA');
ProductionOrder.SETRANGE("Starting Date",010412D,310313D);
IF ProductionOrder.FINDSET THEN BEGIN
REPEAT
CODEUNIT.RUN(5407,ProductionOrder);
UNTIL ProductionOrder.NEXT = 0;
END;
When you run this codeunit, you just have to mentioned the Posting date only.
Thank you gravecz and vivek4121. Will test out the codeunit but for now we'll stick to the Change Production Order Status. That session ensures completed orders are the only orders that will be changed to finished.
Answers
In that case you can create a Codeunit and enter the below code for that:
ProductionOrder.SETRANGE(Status,ProductionOrder.Status::Released);
ProductionOrder.SETRANGE("No.",'RPO/2013/001001','RPO/2013/31090');
ProductionOrder.SETRANGE("Assigned User ID",'SA');
ProductionOrder.SETRANGE("Starting Date",010412D,310313D);
IF ProductionOrder.FINDSET THEN BEGIN
REPEAT
CODEUNIT.RUN(5407,ProductionOrder);
UNTIL ProductionOrder.NEXT = 0;
END;
When you run this codeunit, you just have to mentioned the Posting date only.
Thanks
Vivek
But i'm affraid that this not gonna solve your problem - changing prod order status is "trivial" task.