Hello!
I have a business requirement that a manager can redirect worklist items from one user to another user (because of vacations f.ex.)
I have written code that does this, but I have one problem. If the worklist item has status Available, I cannot redirect them - only those that are Open. The reason seems to be that the worklist item ID is = 0 until it's status changes to Open.
This is my code:
List<WorklistItem> worklistitems = new List<WorklistItem>();
WorklistItems wi = wmServer.GetWorklistItems(DateTime.MinValue, DateTime.MaxValue, fromUserName, "MyProcessName", "%", "%", "%"); //wmServer is my connection to the WorkFlowManagementServer
if (wi != null && wi.Count > 0)
{
worklistitems.AddRange(wi.Cast<WorklistItem>().Where(x => x.ProcessInstanceStatus == ProcessInstanceStatus.Active));
IEnumerator iterator = worklistitems.GetEnumerator();
while (iterator.MoveNext())
{
WorklistItem obj = iterator.Current as WorklistItem;
if (obj != null)
{
wmServer.RedirectWorklistItem(fromUserName, toUserName, obj.ProcInstID, obj.ActInstID,
obj.ID);
}
}
}
This throws an error when the worklistItem is in status Available, because the obj.ID is 0.
Can I somehow force these worklistItems to be Open before I call the RedirectWorklistItem()? Or any other solution would be very helpful :)