Participant Provider Example

30 10 2009

As promised in my previous post, here is a concrete step by step example of how to implement a participant provider class to be used by a Dynamics AX workflow template:

1) Open your AOT, right click on clases, click on ‘New Class’
2) Rename your class to ‘MyParticipantProvider’
3) Edit the class declaration section of the class and add ‘implements WorkflowParticipantProvider’ to your Class declaration i.e. your classDeclaration should now look like this:

public class WorkflowUserGroupParticipantProvider implements WorkflowParticipantProvider

4) Right click on your class in your AOT, click on new method.
5) Edit your new method.
5.1.) Make the method public, rename it to ‘getParticipant tokens’ with no parameters and provide the return type of ‘WorkflowParticpantTokenList’  i.e.

public WorkflowParticipantTokenList getParticipantTokens()

5.2) Your new method now needs to return a WorkflowParticipantTokenList, this is essentially a map with a key/token (which you’ll use later to resolve your users) and a name (for display purposes) that will appear in the drop down list when you select ‘Role based’ in your user selection window of your workflow configuration.


I would reccommend that you use an enum or some for of database table (depending on your purposes to populate this map, but we’ll keep it simple to make it readable, see WorkflowUserGroupParticipantProvider for an example). Our example will use 3 resolvable tokens to allow the workflow owner to decide how he would like his record assigned, I will use the financial dimensions for resolving. Your method should look something like the following:

public WorkflowParticipantTokenList getParticipantTokens()
 WorkflowParticipantTokenList tokens = WorkflowParticipantTokenList::construct();
 tokens.add('DIM1', 'Dimension 1');
 tokens.add('DIM2', 'Dimension 2');
 tokens.add('DIM3', 'Dimension 3');
 return tokens;

5.3) Right click on your class and create the resolve method. your class declaration should return a WorkflowUserList and take a WorkflowContext and WorkflowParticipantToken as a parameter e.g.:

public WorkflowUserList resolve(WorkflowContext _context,
 WorkflowParticipantToken _participantTokenName)

The aim of this method is to provide workflow with a list of system user ids resolved based on the token that was selected in the workflow configuration from our list of tokens that we provided in the previous method (‘DIM1, DIM2, DIM3’). To keep our example simple we will be assuming that we are dealing with a Purchase Order and will return hard coded users for specific dimensions, if the no match is found then the ‘Admin’ user will be returned. So putting this all together:

public WorkflowUserList resolve(WorkflowContext _context,
 WorkflowParticipantToken _participantTokenName)
 PurchTable purchTable;
 WorkflowUserList    userList = WorkflowUserList::construct();

 if (!_participantTokenName)
 throw error("@SYS105453");

 //retrieve purchTable from workflow context (assumption is made that this provider
 //will only be used for Purchase Order workflows
 select purchTable where purchTable.RecId == _context.parmRecId();

 if ((_participantTokenName == 'DIM1') && (purchTable.Dimension[1] == '010')) userList.add('JOE');
 else if ((_participantTokenName == 'DIM2') && (purchTable.Dimension[2] == '010')) userList.add('SUE');
 else if ((_participantTokenName == 'DIM3') && (purchTable.Dimension[3] == '010')) userList.add('ISAC');
 else userList.add('Admin');

 return userList;

5.4) Create a new contruct method for your class e.g.:

public static MyParticipantProvider construct()
 return new MyParticipantProvider();

Your new Provider class should now be available for use/selection

6) Using you AOT, navigate to the approvals or tasks that you would like to use this provider
6.1) Right click, choose properties and select ‘MyParticipantProvider’ from the dropdown list.


6.2) Save the approval. You should now be able to select on of your 3 new participant tokens in your workflow configurations.


I hope this has been helpful. Post and questions comments or suggestions.




4 responses

25 11 2012

hi Jonathan…this is really helping me understand workflow concept in AX.

I wanted overrode the hierarchy participant provider class. if you have any examples like this please let me know.

your response gr8ly appreciated
e-mail :

10 06 2015

Hi Jonathan…
May i get an example of a workflow heirachy class. Not sure how to write it

12 06 2015

Hi Jonathan,
I would like to write a class for Ax2012 Workflow Heirarchy, but not sure how to go about it. Similar to a particpent provider. i actually do not want to use the mangerial heirachy setups – i just need to return a user based on the context record(like a particpent) for escation. Shereen

12 06 2015

Hi Shereen. Unfortunately I do not have a hierarchy provider example at the moment, I will only be able to draw one up in the next week or so as they are a bit tricky. However my recommendation is to look at the standard ones in AX and reverse engineer them after reading the MSDN description to understand their basic process

Sorry I can’t be much more helpful at this point

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: