Skip to main content

Work Flows in Microsoft Dynamics 365 (From Scratch)

Hi everyone,
In this blog, I will tell you some basic steps about how to make a workflow.
I had some issues in making a workflow so I made this blog so all of you can understand it.
The links that I've mentioned below, use them where I've asked in the steps.

Links: (For use)

https://dynamicsaxinsight.wordpress.com/2015/02/16/ax-2012-create-custom-workflow/
https://community.dynamics.com/ax/b/alirazatechblog/archive/2016/10/19/customization-in-new-dynamics-ax-aka-ax-7-part-6-custom-workflow

Steps:

1- Make Base Enum and add values in it.(The values shoule be proper!!!)
2- Customize a table or make a new table as extension wont work in this case because a method is to be over rided.
3- Add this enum to the fields area of that table.
4- Add a field group in the table, it will be used ahead. Fields to be added are of your choice.
5- Override canSubmit.... method of the table.
6- Make a static method in the table.
7- Details of the step 5 and 6 are in the links.
8- If a new table was made for this work flow, then make a form too with a grid and add this table to its data source and drag all the fields in the the grid.
9- Make a menu item pointing to this form in the project.
10- Make a query containing the table made as a datasource.
11- Make WorkFLow category and define the module where this work flow will work.
12- Make workflow type, for the three things that is asks in order to make a WF Type, the query, the menu item and the WF category which have been made in the previos steps.
13- This type will add some artifacts in the project. Open the Submit Manger Class and change it according to the links, this class was made by the type.
14- After this, make a workflow approval. It will also ask for 3 things, the field group that was made in the 4th step, the same menu item, and a doc class which was made after the WF Type step.
15- This WF Approval will also add some artifacts in the project. Now change the WFApprovalEventHandler according to the links, this class was made by WF Approval step.
16- After this, go to WF Type -> Supported Elements, right click and make a new element and change its name according to the WF Approval made.
17- Now, go to the form properties and change and enable workflow and fill the WF Datasource and WF Type fields.(If WF Type drop down is empty, then manually enter the name of WF Type)
18- Build, Sync the project and go to the module which you defined in the WF category. (e.g. If the module defined in the WF category was 'Campaigns', the WF would be found in 'Sales and Marketing' Module -> Setup -> Sales and marketing workflows)
19- Click new and then a dialog will open where the WF type would be in the list which was made.
20- Click on that WF type and it will ask to download if there is something needed to be downloaded otherwise would open a dialog where it will ask for your email and password that is being used at the front end.
21- This will open WF Type, where there would be a start node and an end node.
22- Add the WF Approval, connect it with the start node and end node.
23- Save and activate.
24- Now when you open the client in browser. You will find workflow menu item you can run the workflow from here.
25- All the records in the form are "Not Submitted" for now, click on a record and submit it and the status will immediately change to submitted.
26- After a while, there would be more options on the same record like approve, reject etc.
27- One cheat that the functional people use for testing workflows which makes the workflow a bit fast is by going to General ledger Module -> Ledger setup -> General ledger parameters -> Batch Transfer Rules and change the Transfer Mode from Scheduled Batch to Synchronous.

This is all.
Go through the code in submit Manager Class and Approval Handler class.
And dnt forget to refer the submit menu item to the submit Manager Class or else this class will never be called.

Cheers.

Comments

Post a Comment

Popular posts from this blog

Consume an AX7 custom web service by SOAP endpoint

Dynamics 365 for Operations (a.k.a. AX7) provides several endpoints for web service. In this blog post, I want to describe consuming a D365O custom web service in a C# application using the SOAP endpoint. For a detailed description about service endpoints, you can read the official documentation at  https://docs.microsoft.com/en-us/dynamics365/operations/dev-itpro/data-entities/services-home-page . The main advantage of the SOAP protocol is its descriptive functionality through the WSDL language. SOAP endpoints provide detailed description about contracts and parameters to call each service method. Visual Studio has a great functionality that can read the service description and automatically generate proxy classes to access the service methods. Let’s do an example of consuming a D365O web service in Visual Studio. Run  Visual Studio  and go to  File – New Project , go to  Templates – Visual C# – Windows Classic Desktop  on the left side of the window and select  Console App  

Customization in Dynamics 365 for operation (Dynamics AX, AX 7) – Custom SSRS based on Report

Prerequisite  of this post  is understanding the AOT in Visual studio and basic programming language like C#. In very simple basic level RDP report three objects are required. Data contract,   Data Contract class  ties with extended data types. This class contain properties with getter setters. At run time these properties act as report parameters. Data Provider Class . This class act as container for report logic.  Here we get Report Query or parameters of Data contract class and perform queries on required tables. This class is extended with framework class. Temperory table Temperory table is used as bridge for data between report designer (DataSet) and Report logic. We populate temporary table with required logic in data provider class.  Report Requirement: Client wants a report where End user select Customer and Report shows, Customer Name, Sale order Number, Item Id, Item group. Sales order Quantity, expected delivery date of Sale order and Unit Sales price. The rep