When working with the Workflow scratchpad object it is important to note a couple of things:

  1. Data can be placed on the Scratchpad for later use using the format of workflow.scratchpad.insert_new_var_name_here
  2. You can create variables on the Scratchpad that are any type (e.g. String, Array, Object, etc). This allows for great flexibility, in my previous post, I demonstrate that you can put an array of objects as a scratchpad variable. By utilizing this method, you have an extensible method to retrieve as much data from the workflow as you would ever need.
  3. The Scratchpad can be retrieved from external sources such as Business Rules and Script Includes by first grabbing the Workflow’s contexts (script below shows this method):
var req_item_id = 'id you are looking up';
var item = new GlideRecord('sc_req_item');
if (context.next()){
var scratchpad_var = context.scratchpad.your_var_name_here;
//do something with the scratchpad data here

Note, that you can also place data on the Scratchpad using a “Display” Business Rule, and then retrieve on the client side with a Client Script (“onLoad”).


For More information please see the following ServiceNow Wiki articles: