How to send ONLY the newest Additional Comment via Flow Designer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
19m ago - last edited 18m ago
Hi everyone,
I am building an outbound integration using Flow Designer to send Incident updates (State, Priority, and Comments) to a 3rd party system. My Flow triggers on Record Updated, calls a Custom Action, which then calls a Script Include to build a JSON payload.
My Requirement: I need to include the newest Additional Comment in my JSON payload, but only if the comment field was actually updated. If the user only changes the State, I don't want to send an old comment and cause a duplicate in the 3rd party system.
The issues I keep running into:
- The History Dump: If I pass the Additional comments Data Pill from the Flow Trigger directly into a String Input in my Action, it automatically converts it to a string and dumps the entire history of the ticket's comments into my payload.
- Duplicate Comments: If I don't map the data pill and instead try using incident.comments.getJournalEntry(1) inside my Script Include, it just grabs the last comment ever made. So, if a user only updates the "State" field today, getJournalEntry(1) grabs a 3-day-old comment and sends it again.
My Current Workaround: Right now, the only way I've been able to make this work perfectly is by:
- Passing the Changed Fields array data pill from the Flow trigger into my Action.
- Checking if changed_fields contains "comments".
- If true, querying the sys_journal_field table directly, ordered by sys_created_on descending, with a limit of 1, and grabbing the .getValue('value').
Is there a cleaner, "best practice" way to extract just the newly typed text of a Journal Field natively within Flow Designer.
Any advice or alternative approaches would be greatly appreciated!
