Avoid Over layering in Development of Workflows on Existing Form


Workflow Extension (alternate way)



As we all know that over-layering is restricted by Microsoft in D365FO and in extension canSubmitToWorkflow not working at all.


Last week, I have received the requirement from my project manager to create a custom workflow on the Transfer order form. as I mentioned that over-layering is not allowed. After few hours of brainstorming within the team, we decided to create a custom workflow with the new table which we will use sort of extension and associate the table with the Transfer order form.

Following are the steps to create a custom workflow and associate it with the existing form.

Prerequisite.
Basic workflow knowledge required. 


Step-1 Create a custom Enum or you can use existing.

Reference screenshot.


Step-2 Create a custom table and add two fields Transfer order Id and Status field extend both fields with appropriate Enum or EDTs. In our case Table name is SLD_TransferOrderWorkflow

Reference screenshot.


Step-3 Create relation on Invent Transfer table and our newly created table on the basis of Transfer Order Number.

Reference screenshot.



Step-4 Create Custom Query and Add the SLD_TransferOrderWorkflow table.
Step-5 Create workflow Type.  

Reference screenshot.



Step-6 Create workflow Approval.

Reference screenshot.



Step-7 Drag the workflow approval in workflow type.

Reference screenshot.


Step-8 Override the canSubmitToWorkflow  on SLD_TransferOrderWorkflow.

Reference screenshot.


Step-9 Create a method in the table to update the status on workflow events/approval.

Reference screenshot.



Step-10 Place proper labels on workflow types, approval, and menu items.

Step-11 Build the model and perform the database sync.

Step-12 Now navigate to the workflow form of your module and click on new to create a new workflow.

You can check in the below screenshot my workflow is appearing.

Reference screenshot.



Step-13 configure workflow as per your requirement and activate.

Step-14 Create an extension of the form on which you want to associate workflow. in my case form was inventTransferTable.

Step-15 Add data source table and join with the parent data source. in my case parent table was inventTransferTable.

Step-16 Only two types of joins are supported. Inner and outer.. in my case, I am using inner because I don't have previous records.  but recommend outer join if you have previous records.

Reference screenshot.



Step-17 Now override the initialized method of the newly added (SLD_TransferOrderWorkflow) data source and enable the workflow.

Reference screenshot.



Step-18 Now override the parent table Methode OnWritten and insert the record on our newly added data source as well. Whenever users create or update the Transfer table.  In my case invent transfer table was a parent.

Reference screenshot.




 Step-19 Now build the model and create the new transfer order and verify. for me its working fine without over-layering.

Reference screenshot.





Please feel free to contact me if you are facing any issues during the implementation of this blog.

Support Faryal's Cusine


10 comments:

  1. I follow all above steps but Workflow button is not show.

    ReplyDelete
    Replies
    1. I try to add a vendor creation approval at VendTable, I created a custom table like your steps, but Workflow button is not show. I also create a form for the custom table, and I find workflow button at that form, and I submit record into workflow at my form, finally, I find workflow button at VendTable too.

      Delete
    2. Workflow button not shown on sales order form. Any Idea?
      Where to see?

      Delete
  2. Hi Chau,
    I am facing the same issue.
    I was follow all steps of above article but workflow button not shown on vendor master form.
    Let me know about that

    ReplyDelete
  3. I must say, I thought this was a pretty interesting read when it comes to thisC topic. Liked the material. . .
    navigate to this site

    ReplyDelete
  4. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work.
    Email Extractor Software

    ReplyDelete
  5. Interesting and interesting information can be found on this topic here profile worth to see it. get more info

    ReplyDelete
  6. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. sol·licitud de visat de l'Índia

    ReplyDelete

Virtual Fields Vs Computed Fields

  Virtual Field: A virtual field in D365FO is a field that doesn't have a direct representation in the database. It's a field that y...