Thursday, June 14, 2012

AX 2012 Workflow Customization

Hi Guys,

During these I have working with customisation of Workflows in AX 2012. AX 2012 provides a bunch of APIs which are really easy to use it and create new workflow in AX 2012.

Just you can follow the steps in attached file.

Happy DAXing.. :)


  1. Fair & clear topic to know about workflow customization. Thank you.

  2. Mukesh, Ur tutorial has been very help full. Can u assist me develop a workflow type for stock requisition? "Attached on the invent movement journal"

    1. Just try out to develop, if you face any issues then lemme know.

  3. Hello Mukesh,
    I have downloaded your document and started following the steps.
    however i have missed the part where you say "Modify the code for the main method as shown in the following code". there is not reference to the code i have to copy paste into the Main method. please help.

    thank you

    1. If you have a created different method for Submit then you can call your method from main method, else u can directly write the logic in main method.

    2. Thanks so much for the quick reply.
      i have moved my code to the Main method of the class.

      have you by any chance made any workflow for the sales process?

      thanks again,

    3. the Sales order process.. starting from creating a new sales order and ending at the sales invoice?

    4. Hy Rola,

      Yeah u can develop the same. Post me if u face any issues.

    5. Dear Mukesh,
      I have followed your document and developed a workflow for the sales order document. it all worked well. however, i need to add a stop error that executes when the user clicks the submit button and prevents him from submitting the sales order to the workflow. any advise?

      thank you,

    6. Hy Rola,

      U can write ur logic in canSubmitToWorkflow method.

  4. Dear Mukesh

    Thanks you very much

    I have created workflow in AX 2012 working fine in all Scenarios Except following :-

    I am facing issue on ReSumit workflow button click generating exception "Function run has been incorrectly called.".
    Please guide.

    Regards and Thanks,
    Asif Sanaullah

    1. Hy Asif,

      As per my knowledge resubmit logic is not provided in above scenario. U need to add that functionality..

    2. Refer to class BudgetPlanReviewWorkflow in AOT or any other standard workflow classes ReSubmit logic is defined in those classes.

  5. I have encountered an error while creating a workflow configuration, same error i 've observed in the Workflow document u have shared.

    Error in AX: "An unexpected error has occurred while opening the workflow. See the event log on the AOS and contact your system administrator to resolve the issue."

    the Error Description in Event log: "Workflow threw an exception for the following reason: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."


    "Workflow threw an exception for the following reason: A call to SSPI failed, see inner exception."

    Can u please suggest a solution for the same.

    Thanks in advance

    1. Perform Full CIL... it should solve..

    2. Thanks.... It is working fine now

  6. Hi Mukesh,

    I am facing one issue regarding ax2012 purchase requistion workflow .Here is the below details of problem
    >Purchase requisitions do not properly display workflows if line-item and header workflows are both used in the same workflow.

    Below step i m following not getting expected result.
    Purchase Requisition Workflow
    1. Go to: Procurement and Sourcing > Setup > Procurement and sourcing workflows
    2. Click New
    3. Select Purchase requisition line review
    4. Click Create Workflow
    5. Drag the Review purchase requisition line element from the left workflow elements and drop it onto the canvas.
    6. Connect the Start – Review PR – End
    7. Click Save and Close.
    8. Click OK on the Version Notes window.
    9. In the Activate Workflow window, select Activate the new version.
    10. Click OK.
    11. Back at the Procurement and sourcing workflows, click New.
    12. Select Purchase requisition review.
    13. Click Create Workflow.
    14. Drag the Purchase requisition line-item workflow element from the left workflow elements and drop it onto the canvas under start.
    15. Drag the Review purchase requisition line element from the left workflow elements and drop it onto the canvas between the PR line item workflow and End.
    16. Connect it as follows: Start -> PR line item -> Review PR –> End
    17. Click Save and Close.
    18. Click OK on the Version Notes window.
    19. In the Activate Workflow window, select Activate the new version.
    20. Click OK.
    21. Go to: Procurement and sourcing > Purchase requisitions > All purchase requisitions
    22. Click New Purchase requisition.
    23. For the Name: TestWorkflow
    24. Click OK.
    25. Click Add line
    26. Enter the following:
    a. Procurement Category: Audio
    b. Product Name: test item
    c. Quantity: 5
    d. Unit: ea
    e. Unit Price: 20
    27. Click Financials
    28. Select Distribute amounts
    29. Assign Ledger Account: 110180
    30. Click Close.
    31. Click Submit.
    32. Click Submit again.
    33. CTRL + D to open AOT
    34. Go to: Forms > Tutorial_WorkflowProcessor
    35. Right click on Tutorial_WorkflowProcessor and select Open
    36. In the Processor, click Start.
    37. After the workflow has processed from the queue, press F5 to refresh the purchase requisition.
    38. Click Actions and select Complete to complete the PR line-item workflow.
    39. Click Complete again.
    40. After the workflow has processed from the queue, press F5 to refresh the purchase requisition.

    Actual result:
    The View History is displayed for the PR line-item workflow. You should see the option to complete the PR Review Workflow (Document level).
    Expected result:
    You can see the PR Review Workflow Actions menu just like you can from the All purchase requisitions list page on the AX client.

    Do you have any idea regarding expected result...waiting for your quick reply

  7. Dear Mukesh

    Your Work Flow document has helped me a lot.Thank you Very much.Mukesh can you please help me ,if we have new module and if we want to Apply Work Flow in the New Form in the New Module.

    Thank You

  8. Dear Mukesh,

    As per your document I have created this workflow but while setting it up I am getting an error
    "The previous element do not exist". Path given is \Previous element

    I am unable to find this path to solve this, Plz help regarding this.


  9. Hi Mukesh,

    This was very helpful, Thanks


  10. Hi Mukesh,

    I have developed the sales order workflow as per your document, all goes fine, but when i submit a sales order for approval, the message processing queue works fine, but i am not getting any popups or notifications. Also i am not able to see actions & View History for a Document. Could you please Help brother !!

  11. Hi Mukesh,

    i unable to find any attachment here where it was
    i am new to workflow may i know which class or methods will call at the time of approving workflow


  12. Hi Mukesh,
    Can you please tell me after adding sales workflow i need to disable the button before approved and enable it after approval
    and if i deactivate the workflow the button should be as it is i.e enabled.

  13. Hi,can you please tell me in which scenario we will create workflow?

  14. This comment has been removed by the author.

  15. Hi Mukesh,

    I am facing an issue in Invoice Approvals. When User submits an invoice in the workflow,the Invoice Line disappear after the first step of approval.
    This is very unusual behavior, as even now the error appears for some invoices while other invoices complete the workflow approvals without any error.

    Any guidance will be appreciated.



Recent Posts