Method getJournalEntry() does not work in the inline script of a Flow Action


Description

The method "getJournalEntry()" does not work in the inline script of a Flow Action.

Steps to Reproduce

1. Create a new Flow with trigger as "Updated" on Incident table.
2. Set the condition to Work Notes changes.
3. Add a 'Log' action with level as Info, for 'Message', Toggle scripting on, and enter the below script:
var work_note = fd_data.trigger.current.work_notes.getJournalEntry(1);
gs.info("Worknote_debug: " + work_note);
return work_note;

The result does not give the most recent entry on work notes, but just returns undefined/NULL.
The same script works in a Business Rule and in Scripts - Background.

Workaround

This problem is under review and targeted to be fixed in a future release. To receive notifications when more information becomes available, subscribe to this Known Error article by clicking the Subscribe button at the top right of this form.
 
As a workaround, create a new GlideRecord and re-query it:
var gr = new GlideRecord(fd_data.trigger.table_name);
gr.get(fd_data.trigger.current.getUniqueValue());
return gr.work_notes.getJournalEntry(1);

Related Problem: PRB1392719