How do you reset the workflow status of a purchase requisition from completed to submitted programatically in X++?

StackOverflow https://stackoverflow.com/questions/634478

  •  10-07-2019
  •  | 
  •  

Question

MS Dynamics AX 2009:

I need to do this from the Purchase Order Screen, so I only have the Purchase Requisition number available from the PurchLines Table.

Your help would be really greatly appreciated as there is nothing yet on the net available (that I can find) and there are missing classes in the AX 2009 Tutorials.

All helpful answers will definitely get an upvote from me.

Edit: Purpose is to force the existing workflow to re-execute on the Purchase Requisition from "Submitted" stage when a button is clicked on the Purchase Order Screen.

Was it helpful?

Solution

I found the answer (code) to submit it to the workflow again:

workflowCorrelationId = Workflow::activateFromWorkflowTemplate(workflowTemplateName,recId,note,NoYes::No,'userid');

OTHER TIPS

This will reset the workflow state and status fields in PurchReqTable, but it won't execute any workflow logic:

PurchReqTable::setWorkflowState(PurchReqTable::find(PurchLine.PurchReqId).RecId, PurchReqWorkflowState::Submitted);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top