Skip to main content
Nintex Community Menu Bar

Dear,

I want to do the following:

Once approver filled in some comments I want to filter/extract only the real comment instead of the (approver name) / date  etc.

 

ApproverName (Approved) 15/10/2015 07:54 - 15/10/2015 07:54 (ApproverName) real comment

 

I did try to use the regular expresssion with the following patern: (:ws,]+) ()ws]+) (?:(d:./sw-]+) ()ws,]+) (?<Comment>.*) and replacement text will be ${Comment}

When I run test this expression via 'Run Now' I do see the result I want in the Result box (see screenshot)

I am using Nintex Workflow 2013 version 3.1.4.0 - English

 

Thanks for you help!

That's what I did, unfortunately it's still not working

Running it within the regular expression it's working, like in the screenshot I attached to the original question.

When running the whole workflow it's not working :-(


Hi Ramses,

Thanks for posting this! I have a slight different problem and wanted to know what you thought was the best approach.

I have a WF that runs a FlexiTask on create. When an item is created The FlexiTask sends out an email to my department about 20 people, one of those people has to approve the item. I Need to capture the Approver Comments for this task. When I use the Nintex - Approver Comments I get the following:

           Melissa Smith (Approved) 10/23/2015 12:25 PM - 10/23/2015 12:26 PM

          (Melissa Smith) I'll work on this

          Jen Donald (Not Required) 10/23/2015 12:25 PM -

          Paul Smith (Not Required) 10/23/2015 12:25 PM -

          Kate State (Not Required) 10/23/2015 12:25 PM -

I would like to get the following Results:

          Melissa Smith (Approved)  - 10/23/2015 12:26 PM - I'll work on this

I tried to recreate the the line of text using Variables for example: Name (Outcome) Date - Comment. But I can't seem to get the just the comment that was provided. Although I see it in the WF History.

I also tried to Strip out all of the Not Required comments (including name and date).

I would appreciate your thoughts on my this.

Thank you Melissa


Thanks Martin,

I'm a bit confused   Hoping you can shed some light on this. 

Here is what I did -

After the FlexiTask Action

     1. Added a Set Variable Action to Set mtxt_Comment (Variable) to equal Comments (Field name)

     2. A Build String Action in the Text I added the mtxt_Comments (Variable) and I stored those results in mtxt_Comments

But I could not get the results desired. Where did I go wrong?


Thanks Ramses,

The was my first thought and how I implemented it but it doesn't work that way. It might be because the Task is assigned to everyone so when someone in the group takes the task, everyone else is Not required and that is part of the comments. 

I had another idea i thought I could just replace the line of text "Kate State (Not Required) 10/23/2015 12:25 PM - " with a replace function for each person in my group.  that way I could remove all the unwanted text. It's a bit messy but I should work. 

Any thoughts?

Can I use the replace more then once in a build string action?


Thanks Ramses!!

I tried the following -  added a Build String with a replace function that replaces "Jen Donald (Not Required) {Current Date} {Current Time}  - " (I did this for each person in my group). The build string looks at Approver Comments and replaces the text  "Jen Donald (Not Required) {Current Date} {Current Time}  - "  with a blank.  but it didn't work as I expected. Maybe I didn't do this correctly.  I will look at it again and see if I can figure out whats' wrong.

I'll keep you posted!


You would need to format the current date and current time.  I would also make sure the current time actually matches what is showing the history.  Based on what you were showing earlier, there were two different times noted in the history.  12:26 may be when Melissa responded, which would be at the minimum, when the workflow would continue.

The following regular expression did work for me in the run now.  Please note the two carriage returns before the pattern.  It would get you back to same results as when one person responds.

pws]*(Not Required).*


Thanks so much for replying Jeremiah!!!

Your solution is almost working!!! For whatever reason I'm not getting the comment in the result. 

I also added both the ApproverComment and txt_CommentClean to email just to see the results and it's almost working.  I also tried removing the first asterisk it gave me the comment but also the names of those who were not required. 

txt_CommentClean =

Melissa Smith (Return) 11/2/2015 2:48 PM - 11/2/2015 2:48 PM
(Melissa Smith)

Approver Comments =

Melissa Smith (Return) 11/2/2015 2:48 PM - 11/2/2015 2:48 PM
(Melissa Smith) Testing Comments this submission needs a lot more information than provided
Jen Don (Not Required) 11/2/2015 2:48 PM -

Paul Smith (Not Required) 11/2/2015 2:48 PM -

Kate State (Not Required) 11/2/2015 2:48 PM -

I also did add the two carriage returns but when I saved the regular expression it removed them.

CommentClean_2015-11-02.png

Thanks again Jeremiah Powers


For your particular case, the following expression should work.  It does make the assumption that there will be one first and one last name.

ssw-]*ssw-]*s(NotsRequired).*


Thank you!!! Jeremiah Powers

That seems to fix it in my test site.  I add this to my production and I'll post if it worked as expected.

I implemented my WF last night and can't make changes.

Thanks for your help! hope this also is help for others out there!


Interesting though, I think you could capture the task IDs and query the workflow tasks list.  Then you wouldn't have to worry about the regular expression.

 

 

 

Otherwise, I worked through an expression that should be able to able to capture the comments in one step. It still assumes a name is two words, a hyphenated name is considered one word.

 

(?<ResponsePerson>n^(]+)s((?<Response>e^)]+))s(?<TaskCreationDateTime>ed/.]+s/d:]+?(?:AM|PM)?)s-s(?<TaskResponseDateTime>ed/.]+s/d:]+?(?:AM|PM)?)s(k<ResponsePerson>)s(?<ResponseComment>(?:.(?!(NotsRequired)sk<TaskCreationDateTime>s-))*)(?(?=.*(NotsRequired))(?:(?:+(?:+s){2}(NotsRequired)sk<TaskCreationDateTime>s-)+))

 

You can use any of the following variables in your replacement text to return whichever you would like.

${ResponsePerson} = name of the person who responded

${Reponse} = the outcome of the task

${TaskCreationDateTime} = when the task was created

${TaskResponseDateTime} = when the response happened

${ResponseComment} = the comment

 


Hi Michel,

In the Nintex SDK (Software Developers Kit) for 2010, there is a How To feature called "Set up task approval in an InfoPath form". With this feature, you can control the comment collection directly and gather it before it is submitted to the actual Task List item. This, of course gives you access to it before all of the excess baggage is added in.. I use this almost exclusively on my InfoPath/Nintex workflow products and it will do exactly what you are asking.

Regards,

Patrick Kelligan


Hello @Jeremiah,

I am using the solution (see below) that you provided on November 2.  We finally created an item in production that generated comments. and found an interesting outcome.

ssw-]*ssw-]*s(NotsRequired).*

The solution worked well expect for two things  1. It missed an entire line of not required and 2. this is just interesting! there are two people who have Names like J Mike Smith and John Eric Smith (bascially they have three parts to their name, instead of just a first name and last name) For these users the solution did not clean up there entire name so I had a random "J" and then a random John after the comment. Very Strange! Any Ideas?


The pattern assumes two names, because the run now tester of the regular expression does not differentiate between a space and a line break.  It is possible that it would in reality.  You could give the following a try. 

(?<ResponsePerson>g^(]+)s((?<Response>g^)]+))s(?<TaskCreationDateTime>gd/.]+s]d:]+?(?:AM|PM)?)s-s(?<TaskResponseDateTime>gd/.]+s]d:]+?(?:AM|PM)?)

(k<ResponsePerson>)s(?<ResponseComment>(?:.(?!(NotsRequired)sk<TaskCreationDateTime>s-))*)(?(?=(Ss]*(NotsRequired))(?:(?:

+.*(NotsRequired)sk<TaskCreationDateTime>s-)+))

In the replacement text, put ${ResponseComment}

I'm thinking that to make it as solid as possible, your best bet would be to capture the Task IDs from the Flexi task.  Then query the Workflow tasks list.


Jeremiah Powers

Thanks for this solution! I haven't implemented this since I had to begin working on another project.

I was able to put in a minor solution by doing the following, I grab the Approver Comments and set a Variable (Single Line of Text) named "CommentsApprover". I then use this Variable in a expression action. Which first finds "J Mike" and replaces with "J-Mike". I save this in a Variable "CommentsApprover_Mike". I create a second expression action with variable "CommentsApprover_Mike" "John Eric" and replaces it with "John-Eric" and save it in a Variable named "CommentsApprover_Eric". I then Take  "CommentsApprover_Eric" and I apply the solution from Nov 4. This works around my users that have three parts to their name by putting in these actions I essential make the three part names into two parts and then the solution works perfectly.

Again this is not the best scenario but when pressed for time it will work. I plan on going back and putting in your latest solution.

Thanks again


Sounds Interesting Patrick!

But I do not know how to do what you suggested.   In the FlexiTask I am using a InfoPath for the task response but it is a very simple one. It just some additional text.  

Sorry for the late reply. I put this issue on hold and i'm revisiting it again


Hi Jeremiah,

I have try your regular expression but I can't rebuild the expression according to my preference.

I just want response person, response, task response date time and response comment.

Could you help me?

Thank you.


HI Melissa,

Did you get the result as you want? 

I have the same problem.


H Izyan, 

Not really! But close enough. I need to go back and make a few minor modifications.


Hi Ramses Kooijman

I have implemented regular expression as you suggested, which is working fine. But, i also have some approvers as listed below.

For some users who are consultants, it will be mentioned as (Consultant) )Eg: Chamidisetty, Nagarjuna (Consultant)] next to their name and for non-consultants sEg: Chamidisetty, Nagarjuna] it will be straightforward.

The above regEx is working perfectly fine for Non-Consultants. How to make the above regular expression work, to extract 'Only Comments' in both cases?


Hello. I tried [ws]*(Not Required).*  and the result I got is the following:

Comments: Test
Last Name,

The first part is OK. In the notification email I put "Comments" and then the approver's comments, which it is "Test", but I don't want the second part that says "Last Name,". My scenario would be:

Smith, Melissa (Not Required) 11/2/2015 2:48 PM - 11/2/2015 2:48 PM

 

The result is:

Comments: Test

Smith,

What is the correct regular expression to remove "Smith," I tried by putting a comma like this:

nws,]*(Not Required).*  but it didn't work

Any suggestions?


The most reliable way to get the approver comments is to capture the TaskIDs in the flexi task.

Then loop through each of the TaskIDs and get the data directly from the tasks themselves.

Then you can choose which fields you want to return in the query.

Those four should get you what you want.


I have exactly the same issue. This is the only expression in this thread that achieves any result.



 



Replying to:







Hello. I tried [ws]*(Not Required).*  and the result I got is the following:



 



Comments: Test
Last Name,



The first part is OK. In the notification email I put "Comments" and then the approver's comments, which it is "Test", but I don't want the second part that says "Last Name,". My scenario would be:



 



Smith, Melissa (Not Required) 11/2/2015 2:48 PM - 11/2/2015 2:48 PM



 



 



The result is:



Comments: Test



Smith,



 



 



What is the correct regular expression to remove "Smith," I tried by putting a comma like this:



 



[ws,]*(Not Required).*  but it didn't work



 



Any suggestions?






Parsing text is complicated, liable to fail due to changes and I could get none of the solutions to work anyway. Then I found powersj1 solution. The explanation is not perfect, but led me to the following working solution. (Workflow variables in italics)



1. Capture the task IDs in the flexi-Task (as previously explained). I now have a collection (taskIds) of all tasks that were created by the Flexi-Task.



2. Use a For Each action to loop through the collection of taskIds and save each as 'this' taskId.



3. Use a Query-List to find the task with the same taskId in the list of Workflow Tasks. Save the Approver Comments from this task as taskComments.



4. Check if taskComments were populated, using a Run-If action to check whether taskComments is empty.



5. If taskComments is not empty, then you have found the approver comments, so use a Set Variable action to set approverComments to 'these' taskComments.



6. You may now use approverComments in your notifications (or wherever).


So i need yalls help.



 



This is what i get when i try to only get the real comment.




Reply