Saturday, 6 October 2018

Create custom workflow participant assignment provider type in AX 2012

In Dynamics AX, workflow provider is used to provider specific information to workflow instance on runtime. Let's say we have a scenario in which an employee want to make a request  for anything as per requirements and its requires approval from its department manager/head. In this case workflow provider type participant assignment will be created.

Participant assignment provider type : It is used for resolving a logical role into one or more users ids. For example. this provider is used to resolve a Microsoft Dynamics AX security role into the users assigned to that role.

Following steps are required for creating custom workflow participant assignment provider type.

Step 1) Create a new class and it will implement workflow participant provider interface.





Step 2) Add a new method and enter following code for the getParticipantTokens method of interface. It will be used for defining user groups. In my case its department Manager. Tokens add method accepts first parameter of participant workflow token id and second participant workflow  token name.

Step 3) Add another method and enter following code for the resolve method. This method will be used for adding users to user list . For demo purpose i have added Admin user to user list and it will be returned on runtime and will be send to this user for approval purpose. You may add users as per your requirements.
Step 4) Add below code for construct method.
Step 5) Create new custom participant assignment provider. For this purpose go to AOT and expand its workflow node. Now go to providers node then participant assignment node. Now right click on it and add new participant assignment provider.
Step 6) Set following properties on it. 
  • Name : The name of the custom provider
  • Label : The label of the custom provider
  • HelpText : A description for the custom provider
  • Association type : Specify whether workflow provider is used at company or global level.
  • AvailableForAllWorkflowTypes : Specify whether workflow provider will be used for all workflow types.
  • ProviderClass : Workflow provider class which will be used for specifying the behavior of custom provider. We have created that class provider earlier .














Step 7) Expand newly created workflow provider node and right click on workflow type and add new workflow type. Set your required workflow type on its properties.






















Step 8) You may verify your provider on workflow configuration. Go to workflow designer and go on its step part. Check assignment properties and you will see newly created of type of participant and it will have participant as Department Manager. Remember that Department Manager was add as token in getParticipantTokens method of class.
























No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Custom Business events Part 3 - (Activate custom business event) in D365 F&O

 In this blog we will discuss about the steps to activate a custom business in D365 F&O. As we know that business event catalog does not...