- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2018 12:08 PM
New at ServiceNow, but not with programming/javascript.
I have a workflow in which I have a Run Script activity that sets a variable value in the ScratchPad (workflow.scratchpad.exec2approve = 'OPS';. In a subsequent Switch Activity, I want to access the value of that variable, but when I type in workflow.scratchpad.exec2approve I get an invalid reference message.
Is there a way to do this? If not, is there a better way to set a value in one activity and access it in a switch activity?
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 08:29 AM
It's hard to believe, but it really cannot be done (up to Kingston, at least).
In my opionion, Service Now should implemennt the ${} notation to allow to use a workflow variable in Switches (or in any Workflow related context, such as Conditions, where it also does not work).
Hopefully, with the new "Flow Designer" all this is solved...
If this answer was helpful, I would appreciate if you marked it as such - thanks!
Best
Daniel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2018 07:13 PM
try ${workflow.scratchpad.exec2approve}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2018 09:05 AM
Thanks, Mike.
Unfortunately, I'm still getting the same message.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2018 09:19 AM
Can you share screenshot where you are using.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2018 01:46 PM
I stumbled on the same problem today. How to access custom built scratchpad variables created earlier in the workflow through a native Switch activity.
Think i might have to end up going with multiple IF's