Workflow Scratchpad - Passing information from one task to the next

sreed
Kilo Explorer

This is the first time Ive tried using the workflow scratchpad. Wiki article made it sound easy but its not working for my particular use case. Anyone know what Im doing wrong?


I have a workflow with two tasks. The second waits for the first to complete before it is created. I need to pass information from the first task to the second. On the first task there is a large string field called u_forward_request_details. I need to take the information from that field and put it in the work notes of the second task when it opens.

In the advanced script of my first task is this line:
workflow.scratchpad.request_details = task.u_forward_request_details;
Ive also tried that line as:
workflow.scratchpad.request_details = current.u_forward_request_details;


In the advanced script of the second task:
task.work_notes = workflow.scratchpad.request_details;

8 REPLIES 8

In this particular case its set up to look for a task with the same parent that has a particular phrase in the short description. You could adjust it to look for any other identifying characteristic of the task you are trying to get to.


Jason Stephens
Kilo Guru

So this fell by the wayside wayyy back when this was posted, but now I have another need for it and I can't get it to work. Below is the script I'm using in task #2. Do you see anything I have wrong? I'm trying to populate the assignment group and assigned to fields on task #2 based on those fields from task #1.

var task1 = new GlideRecord("sc_task");
task1.addQuery("parent", current.sys_id);
task1.addQuery("short_description", "PC or Laptop Replacement");
task1.query();
if (task1.next()) {
task.assigned_to.setDisplayValue(task1.assigned_to);
task.assignment_group.setDisplayValue(task1.assignment_group);
}

Thanks for the help

Jason


First I would add some logging to see if your query is returning the first task.
Also, task1.assigned_to and assignment_group will return a sys_id by default, so use it to set the actual value of task fields. Don't set the display value since you won't get a match.


the below script worked wonderfully for me.. just replace my short description with yours..

also please don't forget to mark this as answered if it fixed your issue

________________


assigntask();
function assigntask()
{
var task1 = new GlideRecord("sc_task");
task1.addQuery("parent", current.sys_id);
task1.addQuery("short_description", "Configure workstation and ship");
task1.query();
if (task1.next()) {
task.assigned_to = task1.assigned_to;
gs.log("doug end");
}}