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-07-2011 09:33 AM
I have done this and it works great.
In my workflow, I am assigning the value of approval_date to workflow scratchpad variable
var approval_date = sysapproval.u_approved_on.getGlideObject().getNumericValue();
workflow.scratchpad.approval_date = approval_date;
You need to create a "display" business rule to access your workflow scratchpad variable
http://wiki.service-now.com/index.php?title=Business_Rules#Display_Business_Rules
var workflow = new Workflow();
var context = workflow.getContexts(current);
if (context.next()) {
g_scratchpad.approvalDate = context.scratchpad.approval_date;
}
Then you can access the "g_scratchpad.approvalDate" in your client script.
Thanks,
Rajini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2011 06:02 PM
I am having trouble coming up with use cases for this. Anything you would want on the form and in the workflow to me seems like a reasonable field addition.
Can anyone provide some examples of how they would use this? I have used the scratchpad to story sys_id's for records generated from another workflow but cannot come up with a specific use case for sharing between g_form/workflow scratchpads.
Either way, Rajini thanks for posting an update on how to do this. Great reference for others!