How to compare previous and current worknotes and comments using flow designer

Priyadharashin1
Tera Contributor

Hi All,

 

I have a requirement to send a outbound PATCH request to a 3rd part when ant of the field is changed in Incident form.

When I change the worknotes, the PATCH request includes both the latest worknote and latest additional comment in the Payload , so I am trying to put a filter in the flow designer such that if worknotes is changed only it should be included in the payload and same for additional comment as well.

 

Please provide some suggestions.

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

@Priyadharashin1 

you want to invoke API when?

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

Hi Ankur,

 

API will be triggered when the Incident is updated.

 

 

@Priyadharashin1 

so when update happens you are sending latest work notes and latest comments.

i didn't get the question then

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

Hi Ankur,

 

The question is currently when I change the worknotes the latest comments is also captured in the Payload as per the below script. And I want only the worknotes to be captured in the payload. Same for comments also. When comment is changed only it should be captured in the payload and not the latest worknotes

 

var work_notes = fd_data.trigger.current.work_notes.getJournalEntry(1).toString().trim().replace(/(\r\n|\n|\r)/gm,"");
return work_notes;
 
var comment = fd_data.trigger.current.comments.getJournalEntry(1).toString().trim().replace(/(\r\n|\n|\r)/gm,"");
return comment;