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:

  1. 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.
  2. Replace the default code with the following:

    boolean canSubmitToWorkflow(str _workflowType=”)

    {

    inventTable InventTable;

    ;

    if(!this.ProductApprStatus == ProductApprStatus::NotSubmitted)

    return
    false;

    return
    true;

    }

  3. Check the coding and the syntax by saving the method. If there are any errors then you should be able to fix them here.
  4. 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.
Advertisements
2 comments
  1. naal said:

    Just thoughts
    I think that using this.ProductApprStatus != ProductApprStatus::NotSubmitted instead !this.ProductApprStatus == ProductApprStatus::NotSubmitted is more clearly understandable

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: