g_scratchpad not working on UI Pages
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 10:38 AM
So I am using a business rule on the sys_ui_page table triggered on display. I even tried removing all filter conditions and still get the following in my client script:
Uncaught ReferenceError: g_scratchpad is not defined
Any idea why this would be happening. I found an older thread referencing a business rule that is apparently no longer OOB in Istanbul
.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 11:24 AM
Hi Jason,
There's two places where you can use a scratchpad to store data. The first is on form loads and the other is in the workflow. Each works differently and used for different purposes. In general however, they are both use to share information between different areas of the platform.
Does the business rule is executing before UI page is loading else you will not get the Information from Server to client.
Please refer below link for more information
http://wiki.servicenow.com/index.php?title=Client_Script_Best_Practices
https://servicenowgems.com/2016/10/10/understanding-scratchpad-g_scratchpad/
Can you share your code will have a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 11:26 AM
Hi Jason,
Can you post the sample code, just wanted to check, if the issue is with something else other than g_scratchpad.
Thanks
Naveen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 11:30 AM
Hi Jason,
I feel your pain . I struggled with this before and ended up using session data to pass between client and server. You can find it documented at the link below. It worked relatively eloquently to solve a similar use case of mine. If you need help, post a snippet I can convert to this approach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 12:27 PM
Thanks Dan, if this doesn't work I am thinking I will go the ajax route, but it would be nice to get this working