Update the Completed Method on the Approval Event Handler

The final update that we need to do on our workflow type is to add some code top the Approval Handler to tell the workflow what to do when the workflow completes.

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 update the Approval Event Handler, follow these steps:

  1. Open up the ProductApprovalWFType project and open the Classes group select the ProductApprovalEventHandler class.
  2. This will open up the method browser, and you can select the completed method.
  3. Update the completed method to look like this:

    void completed(WorkflowEventArgs _workflowEventArgs)


    InventTable InventTable;

    forupdate InventTable where InventTable.RecId == _workflowEventArgs.parmWorkflowContext().parmRecId();

    if (InventTable.RecId)


    InventTable.ProductApprStatus = ProductApprStatus::Approved;




  4. After you have updated the method, save it, and if there are any syntax errors, then you will be able to correct them here in the editor. When everything is fine, you can code out of the method editor.
  5. Just to be sure, save your project to make sure that there aren’t any other grammatical errors in the code.

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 )

Connecting to %s

%d bloggers like this: