I am new to ServiceNow and recently I have spent a lot time to understand service catalog on it.

Here is some idea of how to using workflow.scratchpad.variable to deliver variables from catalog item to email notification.

1. Start with catalog item, you should use variable set other than variables to work with variables, the reason is you can define client scripts against variable set other than single item. which can be used on all the items.

i.e. You can use catalog  item. category to decide if you want to show wifi installation area for desktop, which can be used on variable set other than all the items.

so we have some variables on catalog item under variable sets. Next thing you want to do is set workflow.scratchpad.variables to get those values, which can be used everywhere under the same workflow. Yes, everywhere.

2. under workflow designer, add an "run script" activity under the workflow. And set scripts like this:

workflow.scratchpad.phone = current.variables.phone;


Remember, if there are a lot you need to get from variables and it is repeatative, I assume you can use "server include" to set this area, so everytime when you create a new work flow, you can just run that server scripts, which can be once off for all the variables.

3. Now lets jump to the email notification area, I would assume you will have workflow activities in between, how ever under email notification scripts, lets add an email notification scripts as:


4. Next we go to email notification scripts and add a new scripts called testScratchpad as below:

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
	var workflow = new Workflow();
	var value;
	var context = workflow.getContexts(current);
	if (context.next()) {
	template.print("now we can look up if this is through: "+value);
	// Add your code here
})(current, template, email, email_action, event);

 5. Now we can go to item and try it see if this variable is through.


Workflow Acitivity - Check IF it is purticular item Ordered:

var gr = new GlideRecord('sc_req_item');
while (gr.next()) { if (gr.cat_item == "sdfsdf13123sdfasdsafdwasf") workflow.scratchpad.variableName=true; }

About Lei

I am an IT specialist with over 10 year experience - years on Automation, on-Premise or Azure.

I am happy to develop however never want be a full time developer. Only do what I have to do. If it has to be PowerShell,HTML, PHP, CSS, C#, VBS or JS, front end or backend, so be it, doesn't matter!

Spent years with Windows, SCCM, SharePoint, SQL and Exchange servers. For last several years, I have been actively working under On Premise > Azure environment.


Current Certificates:
    Microsoft® Certified-
  • -Enterprise Administrator
  • -Database Administrator
  • -SharePoint Administrator
  • -Administering and Deploying SCCM 2012
Red Hat Certified Technician
ITIL V3 Foundation - Practitioner

Working on Azure Certificates now and hopefully they can stop upgrading their questions one day! GIVE ME A BREAK!

Contact Lei

Name *
Email *
Comments *

Traffic since 10/08/2016

This week517
This month2590

Visitor Info

  • IP:
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online