Hide variables that weren't filled in the request in Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi everyone,
I’m working with a catalog item that contains a large number of variables and many different scenarios. Because of this complexity, creating multiple UI Policies to control the visibility of variables in Workspace would become very difficult to manage.
As an alternative, I’m considering implementing a Client Script that hides variables in Workspace when they were not filled out in the request.
Has anyone implemented something similar before, or can suggest a better approach to handle this scenario?
Any recommendations or best practices would be greatly appreciated.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @AnaLucíaR
1. Create a display Business rule
Refer for code :https://www.servicenow.com/community/developer-forum/how-to-hide-empty-variables-of-ritm-and-task/m-...
2.Create aOnLoad Catalog Client script to hide Variables (Applies to RITM & SCTASK):
function onLoad() {
//Hide all empty variables using the scratchpad of Display business rule
if(g_scratchpad.emptyVars != ''){
var emptyVars = g_scratchpad.emptyVars.split(',');
for(i = 0; i < emptyVars.length; i++){
g_form.setDisplay('variables.' + emptyVars[i], false);
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I created blog for this 5-6 years ago, see that and enhance it for your requirement
Hide empty variables on RITM and TASK record
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader

