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

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!

1 REPLY 1

RAHUL YADAV9
Mega Guru

Hi Joshua,

We can create a For each loop on changedFielsValues. Then

RAHULYADAV9_0-1781770209725.png

If field name is comments then run your logic otherwise we can skip that changed field.

RAHULYADAV9_1-1781770235020.png

Once comments field is identified as changed field then lookup record from journal field table and you have your latest comment.

RAHULYADAV9_2-1781770276250.png

 

RAHULYADAV9_3-1781770297197.png

 

Below is the execution result for the flow i have created.

RAHULYADAV9_4-1781770323124.png

 

If this solution helped you, please consider marking it as Correct and Helpful so it can benefit others as well.
 
Thank You
Rahul Yadav