Symptoms
Worklist item status SmartObject
Diagnoses
I am trying to determine if there is a SmartObject or API to obtain the status of a worklist item when it is assigned to a K2 Role. The destination rule is set to Plan Just Once, limited to 1 slot. The destination is a role and there are 4 users in the role. If I run the Activity Instance Destination Report SmartObject I can identify that the task is assigned to the role but I need to be able to identify the status and owner of the task (if it is allocated) within the role.
Once the task has been completed the instance for the role is updated to complete and a new record is added to identify which user completed the task.
Resolution
Unfortunately, there is not an Out-of-the-box broker/smartobject that would return this information that you are seeking. But I believe this can be done with custom code/customer broker.
Option 1:
If a task is assigned to a role, but WITHOUT the "Plan Per Destination" setting "Resolve all roles and groups to users." I believe you can only retrieve this information through the "SourceCode.Workflow.Client" API using perhaps the "worklistItem.Status" field. This will most likely involve determining the users in the role first, then looping through each of the users in the role calling their "SourceCode.Workflow.Client" > OpenWorklist() to retrieve the task and the current worklist item status of that their task.
https://www.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm_Working_with_a_Process.html?TocPath=Runtime%20APIs%20and%20Services|Workflow|Workflow%20Client%20API|Workflow%20Client%20API%20Samples|_____2
Option 2:
If a task is assigned to a role, but WITH the "Plan Per Destination" setting "Resolve all roles and groups to users." you can use the "SourceCode.Workflow.Client" similar to Option 1.
But it may also be possible to return this information from the "SourceCode.Workflow.Management" API > using the Global Worklist similarly to:
https://www.k2.com/onlinehelp/k2blackpearl/devref/current/default.htm_Working_with_Global_Worklist.html?TocPath=Runtime%20APIs%20and%20Services|Workflow|Workflow%20Management%20API|Workflow%20Management%20Samples|_____8
This would be similar to the data that is available in the K2 Workspace > Wokflow Server > Global Worklist, when using the "Plan Per Destination" setting "Resolve all roles and groups to users." option.
Option 3:
Perhaps the K2 Market Worklist Broker and Management Worklist broker can also provide a starting point/smartobject to do so:
http://community.k2.com/t5/K2-blackpearl/Worklist-Service-Broker/ba-p/889
http://community.k2.com/t5/K2-blackpearl/Management-Worklist-Service-Broker/ba-p/1015
Please know that K2 Market solution are non-tested/supported by K2 Support. But perhaps K2 Remote Services/K2 Community site can provided additional guidance/best practices.