Tracking workflow assignees

27 11 2009

Ok, so here’s the deal. You have a workflow setup in Dynamics AX and you want to for one reason or another know when your work-items are assigned or reassigned e.g. writing to a custom audit trail etc. However there are a few small short-comings with the workflow framework in Dynamics:
1) There is no onDelegate eventHandler
2) The start Event on your approvals is triggered when the approval is started, but before the item is assigned.
3) The users returned from your participant provider class may may not be the final assignee due to delegation (Administration -> Users -> User Options -> Delegation)

So how can you (without any major modifiications) capture who is finally assigned the workitems.
1) Write a batch job to examine open workitems (no system code modification required)
2) Add your code at the end of the ‘saveTracking‘ method on the ‘WorkflowTrackingTable‘ table. At this point the workitem has been assigned to the correct user which you can use for your own purposes. As this is a system class avoid adding too much code here, rather just do a single line to call other code in order to keep your footprint to a minimum. E.G.


static void createNewAuditLog(WorkflowTrackingTable trackingTable, WorkflowTrackingCommentTable commentTable, WorkflowTrackingStatusTable statusTable)
resp_user = trackingTable.User; switch(trackingTable.TrackingType)
case WorkflowTrackingType::EscalationPath : [action was on escalation]; break;
case WorkflowTrackingType::Denied: [action was on workitem denial]; break;
case WorkflowTrackingType::RequestChange: [action was on request change]; break;
case WorkflowTrackingType::Resubmission: [action was on resubmission]; break;
case WorkflowTrackingType::Submission: [action was on submission to WF]; break;
case WorkflowTrackingType::Cancellation: [action was on cancellation]; break;



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: