We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

I want to use the rejection comment within the workflow.

bonsai
Mega Sage

I want to copy the rejection comment for a requested item into a field in a separate table.

Since the rejection comment is recorded in a "Journal" type field, retrieving it within a flow includes unwanted extra information.

Is there a way to retrieve *only* the comment itself?
It would be ideal if it were managed in a specific table somewhere...

I would like to resolve this using flow actions rather than scripts.

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @bonsai 

 

You can  use the .getJournalEntry(1 ) method to parse out just the newest comment without dates or user details.

 

Use a Run Script or Script step in your flow with the following Script:

 

var currentItem = fd_data.trigger.current;

var latestComment = currentItem.comments.getJournalEntry( 1); // dont give space before 1

currentItem.setValue('u_your_custom_field', latestComment); // Populate the separate field/table (use glide record) with this extracted text

 

Refer: https://www.servicenow.com/community/virtual-agent-forum/execute-flow-when-comment-is-added-to-an-in...

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@bonsai 

after the approval step use Lookup record step on sys_journal_field with query like this and grab the Value column which gives you the text entered

Element ID = sysapproval_approver record sysid

Then use the output from this step and do whatever you need to do as per business requirement

AnkurBawiskar_0-1784219791136.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader