Skip to main content
Nintex Community Menu Bar

Hello everybody,

 

I am working to do OutOfOffice using K2 API

 

My Code is the following

WorklistCriteria criteria = new WorklistCriteria();
Destinations destination = new Destinations();
destination.Add(new Destination(("K2:"+AssignedTo), DestinationType.User)); //e.g. K2:DOMAINUsername
WorkType worktype = new WorkType(AssignedTo, criteria, destination);
WorklistShare worklistshare = new WorklistShare();
worklistshare.ShareType = ShareType.OOF;
worklistshare.WorkTypes.Add(worktype);

//Share the worklist
ktwoWorkflowClientServer.ShareWorkList(worklistshare);

//Share the worklist for a managed user
//ktwoWorkflowClientServer.ShareWorkList(originator, worklistshare);

//When the current user's status is set to OOF the worklist shares defined above will take effect
ktwoWorkflowClientServer.SetUserStatus(UserStatuses.OOF);
return true;

 

 

I think this code works fine. The delefate user can see the task of the user that is out of office, but when he want to execute an action from SmartForm it appears the following error

 

24411 K2:** from ** is not allowed to open the worklist item with SN=2063_30

 

Anyone knows what happen?

 

Thanks

If you're using a custom worklist via the API, to open a shared worklist item you need to use OpenSharedWorklistItem(assignedTo, "", serialNumber) instead of OpenWorklistItem(serialNumber). The 'assignedTo' user is one of the fields in each worklist item in the worklist.


Thanks for your help. I have one question more.

 

AssignetTo is the original user or the new User?


The original user.


Reply