Accessing the Workflow Scratchpad from Business Rules

From ServiceNow Wiki
Home > Script > Useful Scripts > Accessing the Workflow Scratchpad from Business Rules
Jump to: navigation, search
Note: This article applies to Fuji. For more current information, see Accessing the Workflow Scratchpad from Business Rules at

The Wiki page is no longer being updated. Please refer to for the latest product documentation.

Role required
Functionality described here requires the Admin role.

Name: Access Workflow Scratchpad from Business Rules

Type: Business Rule

Table: sc_req_item (Requested Item)

Description: A catalog item has been requested, the attached workflow contains a run script activity that populates a value in the scratchpad. From a business rule running on the requested item, we want to retrieve or set scratchpad values.

Parameters: n/a


//the run script activity sets a value in the scratchpad
workflow.scratchpad.important_msg = "scratch me";

//get the workflow script include helper
var workflow = new Workflow();

//get the requested items workflow context
//this will get all contexts so you'll need to get the proper one if you have multiple workflows for a record
var context = workflow.getContexts(current);
//make sure we have a valid context
if ( {
  //get a value from the scratchpad
  var msg = context.scratchpad.important_msg;
  //msg now equals "scratch me", that was set in the run script activity

  //add or modify a scratchpad value
  context.scratchpad.status = "completed";
  //we need to save the context record to save the scratchpad
Was this article helpful?
Yes, I found what I needed
No, I need more assistance