How to compare previous and current worknotes and comments using flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 09:54 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 10:48 PM
you can get to know which field got changed when record is updated
Use the Changed Fields step in flow
Using the data within the "Changed Fields" Pill
Changed Fields of Flow Designer
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 10:54 PM
Hi Ankur,
I tried that. The Previous values always remains empty and current value shows all the worknotes entered so far. Pls see the rela time values below:
{ "Changed Fields": [ { "current_display_value": "18-04-2023 15:33:26 -Priyadharashini (Additional comments)\ntesting comments 2\n\n18-04-2023 15:21:15 - Priyadharashini (Additional comments)\ntesting comments 1\n\n18-04-2023 11:29:21 - Priyadharashini (Additional comments)\ntesting worknotes 2\n\n18-04-2023 09:34:13 - Priyadharashini Vijayaraghavan (Additional comments)\nTEsting worknotes\n\n", "current_value": "", "field_name": "comments", "previous_display_value": "", "previous_value": "" } ] }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2023 11:03 PM
that's because those are journal fields and data for it is stored in sys_journal_field table
you can query that table and get the latest value which will be the previous value for that record sysId and column
Sort it with Z to A for Created column
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 01:58 AM
Hi Ankur,
By your solution I have to store the latest value from the Journal entry somewhere, so once API is triggered, I can compare it. But, Where will I store the previous value before the flow is triggered?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2023 02:22 AM
you can use flow variable which is like global variable or scratchpad variable
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader