Challenge/Problem: Many Dynamics AX Workflow work-items that need to be reassigned at once.
Description: At times we have had the request from clients to reassign many workitems from one person to another. My first reaction is why weren’t delegation parameters setup on the user so that one doesn’t need to manually reassign. However I have come to realise over time that there are a couple of good reasons to do so such as a person falling ill suddenly, a mistake in the workflow config, failure to set delegation parameters in time etc…
Solution: The following script/job designed for AX workflow will reassign workitems from one user to another. You can modify your query a bit to restrict the items to just the one that you want. The attached one simply reassigns all items currently assigned to user “123456” to user “654321”.
NOTE: This will not affect items in your workitem list as a result of queues
static void workflowMassReassign(Args _args)
UserId fromUser = "123456"
UserId toUser = "654321";
//Comment for workflow history
str comment = "Auto-Reassign 2014/11/26 08:00";
while select workitems where workitems.Status == WorkflowWorkItemStatus::Pending && workitems.UserId == fromUser
WorkflowWorkItem::delegateWorkItem(workitems.Id, toUser, comment);
info(strFmt("Items re-assigned: %1",i));