g_scratchpad not working on UI Pages

jasongriffiths
Kilo Explorer

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

.

7 REPLIES 7

balaji_charapal
Kilo Guru

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.


naveenaechan
ServiceNow Employee
ServiceNow Employee

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


danpatino
Tera Expert

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.



Session client data


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