Add a canSubmitToWorkflow Method to the Table to Enable Workflows
Tables need to be enabled for workflow processing before they can be used by the workflows themselves. This is done simply by adding a method to the table called canSubmitToWorkflow.
NOTE: This is part of the Developing a Product Approval Workflow in Dynamics AX 2012 blog series where we show how to develop a completely new workflow to manage the new product approval process. If you want to see all of the other posts in this series, click here.
How to do it…
To add the canSubmitToWorkflow method to the tables to enable workflow processing, follow these steps:
- From within the ProductManagementWorkflows project, open up the InventTable table explorer, and then right-mouse-click on the Methods group, and select New Method.
This will create a new generic method for you.
Replace the default code with the following:
boolean canSubmitToWorkflow(str _workflowType=”)
if(!this.ProductApprStatus == ProductApprStatus::NotSubmitted)
- Check the coding and the syntax by saving the method. If there are any errors then you should be able to fix them here.
- After you have updated the method, return to the project explorer, and then save the project again just to make sure that there are not any problems.
I think that using this.ProductApprStatus != ProductApprStatus::NotSubmitted instead !this.ProductApprStatus == ProductApprStatus::NotSubmitted is more clearly understandable
Naal, old programming styles are hard to kill. I still like my way 🙂