How do you get an approval comment in a flow?

Moedeb
Tera Guru

I would like to be able to update the RITM with a comment added to an approval request via a flow, is there a way to do that?

 

Example:

  1. New catalog item logged 
  2. an approval goes to Team A 
  3. someone adds a comment to the approval when they approve it
  4. I then want to update the RITM with some regular text
    eg: The approval from Team A has now been given and the following comments were added:  - - - - - - - 
  5. Next step in the flow occurs

 

Obviously this becomes even more important if for some reason the approval is rejected.

 

1 ACCEPTED SOLUTION

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Moedeb 

You can do "lookup record" on the sysapproval_approver table and using the condition of "approving" is "Trigger - Requested item" data pill. 

Then you can get comments by approval records - comments" data pill. 

 

You can update the same in the RITM comments by update record.

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra  

View solution in original post

3 REPLIES 3

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @Moedeb 

You can do "lookup record" on the sysapproval_approver table and using the condition of "approving" is "Trigger - Requested item" data pill. 

Then you can get comments by approval records - comments" data pill. 

 

You can update the same in the RITM comments by update record.

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra  

@Ravi Chandra_K thank you very much, works for what I asked for.

The only think now is, how to remove the text before the actual comment - the date/ person making the update etc.

Hello @Moedeb 

Something like this...

Newcomments = current.comments.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm

 

Please refer the below thread:

https://www.servicenow.com/community/developer-forum/how-to-remove-time-stamp-and-name-from-addition...

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra