how to hide case states for certain assignment groups in CSM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 03:39 AM
Hello Everyone,
I have a requirement where I want to hide the state choices for certain assignment groups. I have used Display business rule and onload client script. its working but not in CSM workspace. Can anyone help me so that it can work in workspace as well.
Display BR:
Conditions as Assignment group starts with "3rd party"
Script:
g_scratchpad.hideStates = [131,132,141];
Onload Client script:
function onLoad() {
//Type appropriate comment here, and begin script below
if (typeof g_scratchpad.hideStates !== 'undefined' && g_scratchpad.hideStates.length > 0) {
hideStateOptions(g_scratchpad.hideStates);
}
}
//function to hide state option
function hideStateOptions(states) {
var field = g_form.getControl('state'); //get the state field
//var field = g_form.getValue('state');
if (field) {
var options = field.options;
for (var i = options.length - 1; i >= 0; i--) {
if (states.includes(parseInt(options[i].value))) {
options[i].remove(); //Remove options
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 03:59 AM - edited ‎03-05-2025 04:05 AM
Hello, have you tried setting the UI Type field in the client script to All?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2025 04:03 AM
it should work provided your client script is running for All views.
Ensure Global checkbox is checked
Also try to add alert and see if onchange runs
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader