- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 07:48 AM
I'm working on a (relatively) simple workflow which creates 2 catalog tasks:
1. First task, send to support group manager for approval and comments in the "work notes" field.
2. Second task to server admins for action
The second task needs to include the work notes from the first field. What's a simple way to accomplish this?
Thanks,
Selena Smith
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2016 09:32 AM
Ahhh... See that is the problem, I was assuming this is on the sc_req_item all the way. Change your script to this, hopefully it will work now.
task.work_notes=pullComments();
function pullComments(){
var comments=[];
var gr= new GlideRecord("sc_task");
gr.addQuery("request",current.getValue("sys_id"));
gr.query();
while(gr.next()){
comments.push(gr.work_notes.getJournalEntry(-1));
}
return comments.join();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 07:58 AM
Use a scratchpad.
eg: workflow.scratchpad.wknotes = task.work_notes;
Kind regards,
Sourabh D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 10:10 AM
Thanks. I'm not sure when to store the work notes. Should I add a Run Script activity after the 1st task to store the work notes in a scratchpad variable?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 10:12 AM
Sorry, there was a typo in my script. Try this
task.work_notes=pullComments();
function pullComments(){
var comments=[];
var gr= new GlideRecord("sc_task");
gr.addQuery("request_item",current.getValue("sys_id"));
gr.query();
while(gr.next()){
comments.push(gr.work_notes.getJournalEntry(-1));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 10:48 AM
Thanks, but it didn't seem to work.. There's nothing in the 2nd task's work notes field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2016 10:53 AM
Ahh.. My mind is some where else today. I am not returning anything form the function. Sorry, use this
task.work_notes=pullComments();
function pullComments(){
var comments=[];
var gr= new GlideRecord("sc_task");
gr.addQuery("request_item",current.getValue("sys_id"));
gr.query();
while(gr.next()){
comments.push(gr.work_notes.getJournalEntry(-1));
}
return comments.join();
}