How to access workflow scratchpad variables from client script?

Not applicable

Has anyone done this? Thanks in advance.

6 REPLIES 6

sherman_1206
Tera Contributor

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.


Came across this article, but not sure of this.
http://wiki.service-now.com/index.php?title=Business_Rules#Display_Business_Rules


sherman_1206
Tera Contributor

The workflow scratchpad and g_scratchpad to my knowledge are not the same. Workflow scratchpad is for workflows and g_scratchpad is for forms.


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();