Workflow Scratchpad - Passing information from one task to the next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2011 04:05 PM
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2011 08:46 AM
You can't get access directly to the first task from the second task activity. I see two options.
1. Use a business rule to populate the scratchpad when the first task is updated or closed. Then the second activity could use
task.u_forward_request_details = workflow.scratchpad.request_details;
In this case you'll probably want to enable "run after business rules" on the workflow to make sure the rule populates the scratchpad before second task generation.
2. (This would be my pick) Skip the scratchpad completely. In the second task activity script, query for the first task to get the value. The advanced script would be something like:
var task1 = new GlideRecord("some_task_table");
task1.addQuery("parent", current.sys_id);
task1.addQuery("short_description", "Task 1");
task1.query();
if (task1.next()) {
task.u_request_details = task1.u_request_details;
}
You'll have to adjust the script so the query makes sense in your case.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2011 11:24 AM
I was trying the same basic thing, and I noticed your comment. You are referring to the first task as parent in your 2nd example. Does the system see the first task in a 'flow' of tasks as a parent? I like your 2nd solution much better than the scratchpad, but I wanted to make sure I was understanding the operation. I would think a query for parent would return the RITM.....
Thanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2011 01:51 PM
The RITM is the parent for the task records. That query is looking for any tasks with the same parent as the current task.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2011 04:33 AM
I see that now. I just looked at the code wrong. Thanks for clarifying. I guess this wouldn't work if you had more than one previous task? Would It know which one to write to?