- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2017 09:50 AM
Hi Experts,
Is it possible to use output of a run script activity from workflow in workflow.scratchpad.<var> in script include and then use it in UI Action to control its visibility.
Ask here is. In UI Action condition: Script Include will be called and based workflow.scratchpad.<var> the visibility of the UI Action to be controlled.
Appreciate your responses.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2017 10:18 AM
Hi Shilpa,
please check the below thread.
Accessing the Workflow Scratchpad from Business Rules - ServiceNow Wiki
Simply you can retrieve it in your script include function.
Also refer the below link.
Workflow Scratchpad Tip | SN Commander
Thanks,
Harshvardhan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2017 10:18 AM
Hi Shilpa,
please check the below thread.
Accessing the Workflow Scratchpad from Business Rules - ServiceNow Wiki
Simply you can retrieve it in your script include function.
Also refer the below link.
Workflow Scratchpad Tip | SN Commander
Thanks,
Harshvardhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2017 11:10 AM
Hi Harsh,
I have already tried this. I am getting Undefined as the result when i try to print it in gs.log.
Below is my function in script include:
checkworkflow: function() {
//get the workflow script include helper
var msg = '';
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 (context.next()) {
//get a value from the scratchpad
msg = context.scratchpad.important_msg;
//msg now equals "scratch me", that was set in the run script activity
gs.log("Message equals = "+ msg +' '+current.number);
}
Log output looks like : Hello World undefined RITM0010049