Query Approver Comments in Workflow Tasks

  • 30 October 2015
  • 9 replies
  • 19 views

Badge +5

I have setup a workflow so that it queries the approver comments in the 'Workflow Tasks' list on the same SharePoint site. The workflow then puts this value into a variable called 'vApproverComment', so that it can then be included on a notification e-mail that's sent to the initiator.

 

The problem I'm facing is that while this works for the first instance of the workflow, I am not able to retrieve any approver comments that are given later on in the workflow.

 

In the 'Query List' action, I have the following filters:

 

Workflow Item ID = ID

Workflow List ID = List ID

Workflow Instance ID = Workflow Instance ID

 

(In the above, the first value in each line is from the Workflow Tasks list, and the second value is from my main list).

 

I just can't seem to be able to target the approver comment for each FlexiTask, but rather only the first one for the whole workflow.

 

Any help would be hugely appreciated. I can upload a copy of the workflow if need be.

 

Thanks all


9 replies

Userlevel 5
Badge +12

There are built in variables that already exist within the workflow that do just this.  No need to query.  (Note I am using On-prem edition - O365 may vary).  They are under the common tab:

137226_pastedImage_1.png

Badge +5

Hi Mike - Sorry, I should have been clearer. I already know about these in-built references. The problem with them is that they give lots of meta data (username, date, time) before the comment itself. I want to target just the comment.

Badge +9

Look at Get Task History and display on your form.  from Dan Stoll . It will give You hints to get required info by web service.

Kind regards

Manfred

Badge +5

Thank you Martin - I've tinkered around with the query list filters and finally got it to work.

Badge +3

Hi, may I know your solution for this?

I have the same issue, still figure out how to retrieve other approver comments.

Thanks

Badge +5

Hi - Sorry for not responding, when I get time this week I'll post a full explanation of how I did this (if you still need it?)

Badge +3

Hi Shaun,

Yes I would love to learn your solution. Take your time. No rush.

Thank you.happy.png

Badge +5

Just to re-cap, I wanted to target approver comments without getting all of the meta data such as approver name, date, time, etc.


Here is my solution, which is still working for me after several months:

1) First of all, you need to create some variables to store the comments in. Create the following variables:

     a) 'current task ID' - (Type: List Item ID)

     b) 'approval ID collection' - (Type: Collection)

     c) 'current comment' - (Type: Single line of text)

2) Then in the workflow, insert a 'Query List' action. This should query the 'Workflow Tasks' list. Filter should be set to 'ID' is equal to 'current task ID'. Then at the bottom of the action, set 'ApproverComments' field (this is from the Workflow Tasks list) to 'current comment'.

3) Next in the workflow, insert a 'Log in history list' action. In this action, simply insert '{WorkflowVariable:current comment}' (without the apostrophes).

4) Finally, around these two actions insert a 'For Each' action. This should wrap around the two previous action. In this action, under 'Target Collection' put 'approval ID collection,' and under 'Store result in' put 'current task ID.'

Once you have followed the above steps, you should be able to retrieve the approver comment by selecting the 'current comment' variable. For example, you can create a 'send notification' action and simply insert this variable and it'll just show the approver comment without any of the meta data.

Remember it's important to include the 'for each' action and wrap it around the actions outlined in steps 2 and 3, otherwise Nintex will simply put the same approver comment in the 'current comment' variable for all future instances of this action.

Hope that helps. This doc explains it in more detail, with screenshots. Really easy to follow:

How to query for approval comments directly

All the best

Shaun

Badge +2

i am also stuck here kindly help me

Reply