I have a requirement to handle the following scenario through code:
It appears that I can create the change request using the VersioningPurchaseOrder class, so I don't anticipate problems there.
However, I can't determine what the submit button on the workflow action bar is connected to. How do you find the code behind that? I don't see anything in the form on the AOT that points to the workflow action bar.
Next, how do you about determining when the submitted change request has actually been processed.
Lastly, where can I find more information about working with workflow processing through code?
Thanks in advance for any help provided.
The link below talk about how to create a SubmitToWorkflow class for a particular workflow.
Workflow::activateFromWorkflowType(_workflowTypeName, _recId, _initialNote, NoYes::No);
is of most interest to you. You can use this method from the Workflow class directly in your code to start a workflow.
My blog | PBC
This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
Dominic's suggestion provides you with the basic code to auto-submit a record into workflow. However calling this on its own may by-pass certain business logic being executed when manually submitting a record into workflow e.g. Changing the record's status to in review etc....
For your workflow take a look at the code in the class behind the submit menuitem. For Purchase Orders this is the PurchTableWorkflow class, with particular focus on the Submit method which calls through to the "submitToWorkflow" method on the purchTable. In this method, the versioning takes place.
General AX Enthusiast and Blogger
Two additional questions:
Hi Steve, the simple answer is to look at your Purch status to see whether it is in Review or approved/confirmed. You can also lookup in your workflow tables to see if there are any active workflows for your record. (SysWorkflowTrackingStatusTable)
Thanks. It appears that I can also check the value of ChangeRequestRequired on the PurchTable record.
I don't see a SysWorkflowTrackingStatusTable in the AOT. We are still on RTM.
Hi Steve. My apologies, its just WorkflowTrackingStatusTable.