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 12:24 PM
I am using a business rule on the sys_ui_page table that is trigger on "display".
(function executeRule(current, previous /*null when async*/) {
var util = new SMDBUtil();
var limit = parseInt(util.getEnvProperty('com.xxxx.quicksearch.results.max'));
g_scratchpad.limit = 'Note: QuickSearch is limited to ' + limit + ' results.';
g_scratchpad.test1 = 'test';
})(current, previous);
client code:
$j("#QuickSearchLimit").text(g_scratchpad.test1);
also get the same error when attempting:
console.log(g_scratchpad.test1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2017 12:33 PM
Oh interesting. I thought you were trying to use the g_scratchpad within the markup or client script of an instance of a UI Page.
I'm guessing this should still work:
(function executeRule(current, previous /*null when async*/) {
var util = new SMDBUtil();
var limit = parseInt(util.getEnvProperty('com.xxxx.quicksearch.results.max'));
//g_scratchpad.limit = 'Note: QuickSearch is limited to ' + limit + ' results.';
gs.getSession().putClientData('limit', 'Note: QuickSearch is limited to ' + limit + ' results.');
//g_scratchpad.test1 = 'test';
gs.getSession().putClientData('test1', 'test');
})(current, previous);
//client-side
$j("#QuickSearchLimit").text(g_user.getClientData('test1'));
console.log(g_user.getClientData('test1'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2017 02:10 PM
Any luck with this approach Jason?