The CreatorCon Call for Content is officially open! Get started here.

copy worknotes from previous tasks to current task

siva14
Tera Contributor

for copying worknotes from previous task to current task, we have used scripting in flow designer in each create catalog task activity, but it's not working , not updated the worknotes, please help is there anything i have missing,

 

 

var previousTask = new GlideRecord("sc_task");
previousTask.addQuery("request_item", fd_data.subflow_inputs.request_item.sys_id);
previousTask.orderByDesc("sys_created_on");
previousTask.setLimit(1);
previousTask.query();
if (previousTask.next() && previousTask.work_notes) {
    return "From: " + previousTask.getValue("number") + "\n" + previousTask.work_notes.getJournalEntry(1);
}
 
#flow designer # work notes
2 REPLIES 2

DrewW
Mega Sage

Work notes is a journal field.  Journal fields are always blank.  So your if statement will always return false.

 

Try replacing previousTask.work_notes with previousTask.work_notes.getJournalEntry(1)

 

You may want to consider querying the sys_journal_field table to get all of the information you are looking for unless you just want the last work note entered only.

 

siva14
Tera Contributor

Hi @DrewW 

As you mentioned i have updated, but still not working, and also i have tried using "-1" also, nothing will come up to next task