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.
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.
Great (Y)
ReplyDeleteThankyou.
Delete