Monitoring workflow tasks
Several service operations in the Workflow web service can be used in Nintex Workflow 2013 to retrieve information about workflow tasks.
Getting running workflow tasks
You can use any of the following service operations to obtain a collection of running workflow tasks, depending on the desired workflow scope and retrieval scope:
-
Gets a collection of running workflow tasks from reusable or list workflows, associated with the specified file in a SharePoint document library.
-
GetRunningWorkflowTasksCollection
Gets a collection of running workflow tasks associated with the specified user, site, and SharePoint list.
-
GetRunningWorkflowTasksForCurrentUser
Gets a collection of running workflow tasks for the current user, associated with either the current site or the specified file in a SharePoint document library.
-
GetRunningWorkflowTasksForCurrentUserForListItem
Gets a collection of running workflow tasks for the current user, associated with the specified SharePoint list item.
-
GetRunningWorkflowTasksForListItem
Gets a collection of running workflow tasks associated with the specified SharePoint list item.
All of these service operations return a collection of UserTask objects, each of which represents a running workflow task assigned to a given user.
Understanding UserTask
When a workflow task is created and assigned by a workflow action in SharePoint 2013, task items are created in the corresponding SharePoint task list for that workflow. A task item is created for each assignee in the workflow task. If a workflow task is assigned to a group, the workflow task can either create one task item for the entire group, or one task item for each user in the group, depending on whether the Create individual tasks for all group members option is disabled or enabled, respectively, for the workflow task.
Similarly, Nintex Workflow 2013 creates and stores task information for each assignee in the Nintex Workflow content database for the site. The information stored by Nintex Workflow 2013 supports additional Nintex features, such as LazyApproval, and links the additional information to the SharePoint task item.
The UserTask object exposes the information stored by Nintex Workflow 2013 export (.nwp) file about the task item for an assignee. You can use the UserTask object to not only identify the corresponding SharePoint task item, but retrieve additional information, such as the task type, specific to Nintex Workflow 2013. For more information about task types, see Workflow tasks.
Getting task stubs for running workflow tasks
The information returned by the GetRunningWorkflowTasks service operation, and its related service operations, is useful for detailed reporting on running workflow tasks for administrative purposes. If you want to retrieve basic information on running workflow tasks for the purpose of processing task responses for the current user, you can forego the detailed information provided by GetRunningWorkflowTasks and, instead, use the GetTaskStubsForCurrentUser service operation. The GetTaskStubsForCurrentUser service operation returns a collection of TaskStub objects, from the Nintex.Workflow.Reports namespace. Each TaskStub object represents not just basic information about a running workflow task for that current user, but a key piece of information, the task token, that you can use to more quickly process task responses.
Understanding TaskStub
The TaskStub object relays basic information about a task, such as the name of the workflow and workflow activity that created the workflow task, for display purposes, and the task token for the workflow task and the current user.
A task token is an encoded string that uniquely identifies the combination of an approver, a task item, and the Nintex content database that contains information about the task item. For more information about task tokens, see Workflow tasks.
You can use the task token provided by the TaskToken property of the TaskStub object to either retrieve more detailed information about the task item, by using the GetTaskDetailsUsingStub service operation, or process a task response for the task item, by using the ProcessTaskResponseUsingToken service operation.
The GetTaskDetailsUsingStub service operation returns a WorkflowTaskDetail object that represents detailed information about the workflow task for the task token. For more information, see WorkflowTaskDetail.
The ProcessTaskResponseUsingToken service operation process a task response for the task represented by the task token. For more information, see Processing workflow task responses.