How to access workflow scratchpad variables from client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2011 11:30 AM
Has anyone done this? Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2011 11:56 AM
You can do this but I suspect there is a much easier way to do this.
Client scripts run in the browser, work flow and scratchpad are sitting on the server so the short answer on how to do it is from your client script make an ajax call to server to get the scratchpad data.
Can you provide more context so we can discuss if this is really the only option you have in terms of what you are trying to achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2011 12:10 PM
Came across this article, but not sure of this.
http://wiki.service-now.com/index.php?title=Business_Rules#Display_Business_Rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2011 01:51 PM
The workflow scratchpad and g_scratchpad to my knowledge are not the same. Workflow scratchpad is for workflows and g_scratchpad is for forms.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2011 04:51 PM
That's right. The workflow scratchpad is "only accessible from within the workflow." You can do some trickery with a Run Script activity and push the values into field(s) on the record though.
For instance you could run this in a Run Script Activity to get the value of the some_variable on the scratchpad:
current.work_notes = "My workflow scratchpad for some_variable is " + workflow.scratchpad.some_variable;
current.update();