how to query for approval comments directly
DESCRIPTION
Nintex Approval Comment Querying in SharePoint WorkflowsTRANSCRIPT
-
How to query the workflow task list for approval comments
Contents Introduction ........................................................................................................................................ 2
Querying for any approval task comment based on task name and item ID (Nintex Workflow 2007
and 2010). ........................................................................................................................................... 2
Running the workflow (Nintex Workflow 2007 and 2010). .............................................................. 10
Alternative design - Querying for approval comments based on approval task list ID (Nintex
Workflow 2010 only). ....................................................................................................................... 11
-
Introduction This tutorial will describe how to query for any user approval comments and store them to a
collection variable. This will remove any other text apart from only the actual comments.
This resulting variable can then be used in an approval email or any other action, even as a reference
to update a SharePoint field. As the collection variable can return multiple values it can then be split
into separate comments. This can be done using a For each action to loop through each value in the
collection.
Querying for any approval task comment based on task name and item ID
(Nintex Workflow 2007 and 2010). The first step will be to create the approval workflow that will contain an approval action of some
kind. The approval actions include Request Approval Flexi Task Request Data, etc. Basically,
any workflow action that requires user interaction involving entering some comments when
completing the task.
In this example the Request Approval action will be used.
Create a new workflow as normal and add a Request approval action.
Configure the action to send the approval request to the workflow initiator. The initiator is the user
who started the workflow. This will help ensure the user who manually started the workflow also
receives the approval email. This process is also recommended when creating new workflows to test
they are working as expected.
-
Shown below is the reference to insert for the Approvers configuration setting.
-
The next step is to configure the query list action to query for any comments after the task has been
completed. Add a Query List action after the Request Approval action.
The Query list action must be configured to look in the task list (where all workflow tasks are
created), find the appropriate task and then return the field named ApproverComments. This field
stores any comments that were entered by the user. To find the appropriate task we will use
Workflow Item ID, Workflow List ID and the task Title to ensure the correct task comments are
returned.
The Workflow Item ID refers to the ID of the item the workflow ran on originally to create the task
and the Workflow List ID is the ID of the list from which the workflow originated. By using these
two values, only the appropriate comments will be returned.
-
Filter settings:
ID:
-
List ID:
The results for this action will be returned to a variable of type Collection. This variable is used
when returning one or more results.
The last step is to add a Log to history list action to log the result of the Query List action and
confirm the comments are successfully being returned.
-
Final workflow design:
-
Running the workflow (Nintex Workflow 2007 and 2010). Using the test list where the workflow was published, create a new item and then manually start the
workflow.
Then click on the In Progress status to view the workflow status and select the approval task.
Respond to the task as normal with any comments.
Checking the workflow history we can see the variable comments collection now contains all
approval comments.
-
Alternative design - Querying for approval comments based on approval
task list ID (Nintex Workflow 2010 only). The Request approval action also has the option of storing any associated IDs into a collection
variable. This option is only available in Nintex Workflow 2010.
In the request approval action you can store any task IDs created into a workflow collection variable.
Using this collection variable result you can then loop through each ID and query the task list for the
approval comment associated with the particular task ID. This is done using a For Each loop.
The overall workflow design will look similar to the following. This process will be directly after the
approval action.
-
For Each loop configuration:
-
Query list configuration:
This action will return the ApprovalComments field based on the current ID value in the For each
loop.
-
The Log to history list action is used to log the current comment.
This variable can also be used in any other workflow action, for example, to update a SharePoint
field.