How to send ONLY the newest Additional Comment via Flow Designer?

Joshua Prakash
Tera Expert

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:

  1. 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.
  2. 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:

  1. Passing the Changed Fields array data pill from the Flow trigger into my Action.
  2. Checking if changed_fields contains "comments".
  3. 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!

0 REPLIES 0