Basics requirements for Participant Provider Classes.

21 10 2009

Participant Providers in Dynamics AX 2009 are very useful classes for one to use in order to customise how work items are assigned within a workflow based on your specific business rules. For example, we can create a provider class that returns users for our purchase requisitions based on certain fields within the PurchTable, i.e. all purchase orders with a specific dimension must go to Joe and all purchase orders with a different dimension to Frank and all the rest must be assigned to chosen user group.

At its very essence, the provider class must do have the following three components:
1) It must implement the WorkflowParticipantProvider class i.e.

public class MyProvider implements WorkflowParticipantProvider
{
}

2. It must implement the getParticipantTokens method i.e.

public WorkflowParticipantTokenList getParticipantTokens()
{
    WorkflowParticipantTokenList userGroups = WorkflowParticipantTokenList::construct();
    ;
    //add participant tokens to list in format userGroups.add([key], [name]);
    return userGroups;
}

3. It must implement the resolve method i.e.

public WorkflowUserList resolve(WorkflowContext _context,
WorkflowParticipantToken _participantTokenName)
{
WorkflowUserList    userList = WorkflowUserList::construct();
;
if (!_participantTokenName)
throw error("@SYS105453");
//TODO - add users resolved based on token name to the list. in the form userList.add([userid]);
return userList;
}

Once you have performed these three steps you should be able to select your new user provider class for your approval.
Stay tuned for an example of how to implement an advanced participant provider.

Cheers.

UPDATE: Check example over here

Advertisements

Actions

Information

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: