Nintex Workflow: How to get approved by Person name from a group task

26. April 2016 03:02 by Rashid Aziz in Sharepoint blogs  //  Tags: ,   //   Comments

Quite often it is necessary to get the name of the person who approved /rejected the task for auditing purpose or to display history as per business requirements. Imagine a Nintex workflow task is assigned to a group called “Legal Team. The task only needs to be approved by one person.  Nintex workflows provide out of the box variable to hold the approver name called “Last Task Respondent”. But if the task is assigned to a group rather than individuals, this variable will only store group name instead of the individual user name who approved it.  I came across this problem recently.
This left me with only one option, which is to extract the task approver person name from the “Approver Comments” common reference variable


In my case the approver comments looks like the below string. The task was assigned to “Legal Team” and approved by “Rashid Aziz” with some comments.


Approver Comments: Legal Team (Approve) 4/26/2016 10:20 AM - 4/26/2016 10:20 AM (Rashid Aziz) the approvers comments


The next steps will explain how to extract the approver name from above “Approver Comments” string

Workaround
Create three workflow variables

 


Note: Set “ApproverCollNumberIndex” value to 1. I will explain later why you need this to be set. 

Now create two operation actions under task "Approve" branch
1. Regular expression
2. Collection operation


 Double click on regular expression action and set the fields as below and store the results inside “ApprovedbyTextCollection”

Pattern: (?<=\()(.*?)(?=\))
The above pattern will extract the data within the brackets and will save it to result collection.
The collection will contain task outcome and approver name separated by semi colon e.g. “Approve;Rashid Aziz;”

Now, next step is to retrieve the approver name from the “ApprovedByTextCollection” collection.  The collection values are separated with semi colon and starts with index 0. The approver name is at index 1. This is why we set the “ApproveCollNumIndex” variable default value to 1.
The final step is to configure the Collection operation action as appear below. Set the index value to “ApproverCollNumIndex” variable (we set this default to 1) and store the results into our final variable “ApprovedByName”.

The Workflow variable “ApprovedByName” contain the task approver’s name at last. This variable value can now be stored separately as per business requirements. In my case I had to store approver name with date task submitted and date task approved date in a separate list fields and displayed them on the form in a more readable table format.

Happy no code solutions 

 

blog comments powered by Disqus

Stay connected

SharePoint Links

Month List