unable to change status for a worklist item for a user

  • 30 November 2005
  • 3 replies
  • 3 views

Badge +2
I am unable to see the changes made through the code to a worklist item

My requirement.
I want to Open the worklistitem based on certain logic for a user.

My code
public static void PushTask(decimal PROC_INSTANCE_ID,string DestUser)
{
if (!DestUser.ToUpper().StartsWith("ROCD1"))
{
DestUser = "ROCD1"" + DestUser;
}
Model.Workflow.ProcessInstance wfpi = Model.Workflow.ProcessInstance.GetByKey(PROC_INSTANCE_ID);
K2Manager MGR = new OMSK2().GetAdminConnection();
string folio = wfpi.OMS_SALES_ORDER_ID + "-" + wfpi.OMS_SYSTEM_ORDER_SEQ_NUM;
SourceCode.K2Mng.WorkListItems wkls= MGR.GetWorkListItems(null,null,null,null,folio,null,null);

foreach(SourceCode.K2Mng.WorkListItem w in wkls)
{
if (w.Destination.ToString().ToLower().Equals(DestUser.ToLower()))
{
MGR.Login(new OMSK2().ServerName,K2.PORT,OMSK2.ADMIN_CONN_STR);

w.Status= WorkListItem.WorklistStatus.Open ;
MGR.RedirectWorklistItem((int)w.ID,DestUser.ToLower());
MGR.Logout();
}
}
}
the code executes fine but still I dont see the status of the worklist for that user as OPEN.It is still in ALLOCATED state.What am i missing here?

3 replies

Badge +11
The Status property of the Worklist item is read-only through K2Mng and cannot be changed.

Personally, I don't understand your code. You loop through ALL worklist items with a specific folio, picking out items assigned to a specific destination user and then try to re-direct the item to the same user.

Regards,
Ockert
Badge +2
Hey, Thanx for the quick reply..I appreciate it...

All I want to do is make the status of the worklist item for that user as Open so that it appears as his worklistitem and for others it appears as allocated.

This is mainly done as a part of load balancing or Assiging tasks as per SKILL.
Hope this will clarify your doubt and look forward to your help

Regards
keshava
Badge +11
Haven't tested this but logically I would think:
Loop through all the worklist items with the specific folio
Look for the one item with 'Open' status
If the currently assigned user is NOT the required dest user, redirect the item to the new user.

Not sure whether the new user will now sit with 2 worklist items - to be checked.

Regards,
Ockert

Reply