Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
β08-22-2025 08:27 AM
Hi @Sprankle
Fix Options
Option 1: Use onDisplay Business Rule directly for section visibility
Instead of passing only a flag to scratchpad, you can directly push a UI Policy / setSectionDisplay logic inside the onLoad script but controlled by g_scratchpad (ensuring itβs always available on first load).
Update Display BR like this:
(function executeRule(current, g_scratchpad)
{
var rpSysId = gs.getProperty('port');
var gr = new GlideRecord("sc_item_produced_record");
gr.addQuery("task", current.sys_id);
gr.query();
g_scratchpad.showSelfTab = false;
if (gr.next() && gr.producer == rpSysId)
{
g_scratchpad.showSelfTab = true;
}
})(current, g_scratchpad);
Then your Client Script remains:
if (g_scratchpad.showSelfTab)
{
g_form.setSectionDisplay('self_', true);
// show
} else
{
g_form.setSectionDisplay('self_', false);
// hide
}
This ensures the scratchpad flag is always ready on first load.
--------------------------------------------------------------------------------------------------------------------------
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ο YouTube: https://www.youtube.com/@learnservicenowwithravi
ο LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ο YouTube: https://www.youtube.com/@learnservicenowwithravi
ο LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/