Copy last work note from task to parent incident

melsarrazin
Tera Contributor

I am using Flow Designer and can get all of the notes to copy over, but to weed out noise, I only want the most recent note. This is being copied from the task to the parent incident if there is a new note when the task is closed.

melsarrazin_0-1747937383618.png

 

Here is the Update Record I have configured. Only pulling in the data pill pulls all the notes. 

I need to be able to also include the Task Name, Task Number, and State field to the note as well.

melsarrazin_1-1747937550710.png

 

I have also tried Transform Functions which are not working either. 

melsarrazin_2-1747937600027.png

 

1 ACCEPTED SOLUTION

John Gilmore
Giga Guru

You won't be able to do it easily with a transform function since dot walking to journal fields returns a string.

Create a Flow Variable of type string to contain the last work note. Then use the Flow Logic action "Set Flow Variables" just before you update record step to set it using the .getJournaEntry() method in script.

return fd_data.trigger.current.work_notes.getJournalEntry(1);

Since it appears from your screen shots that you are getting the work notes field from the trigger you can use the fd_data.trigger.current to access the glide record of the trigger so this can be done with a single line of code.

Then you can use the Flow Variable in the Update Records step rather than the work_notes field from the trigger and it should contain just the last work note. This is because the .getJournalEntry(1) method will return the last work note.

View solution in original post

2 REPLIES 2

harish41
Tera Guru

Hi,
We can achieve this using Flow variables. By keeping below script in script section of flow variable and use that flow variable data pill in your update record activity.

return fd_data.trigger.current.work_notes.getJournalEntry(1);


Regards
Harish

John Gilmore
Giga Guru

You won't be able to do it easily with a transform function since dot walking to journal fields returns a string.

Create a Flow Variable of type string to contain the last work note. Then use the Flow Logic action "Set Flow Variables" just before you update record step to set it using the .getJournaEntry() method in script.

return fd_data.trigger.current.work_notes.getJournalEntry(1);

Since it appears from your screen shots that you are getting the work notes field from the trigger you can use the fd_data.trigger.current to access the glide record of the trigger so this can be done with a single line of code.

Then you can use the Flow Variable in the Update Records step rather than the work_notes field from the trigger and it should contain just the last work note. This is because the .getJournalEntry(1) method will return the last work note.