- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 10:06 PM
I have created a one-check box with the label "not visible in assignment group" in the group table form when that checkbox is selected we want to make sure the group is not visible in any Assignment groups How can we do this using script
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 10:42 PM - edited 02-07-2024 10:49 PM
You can create a before query business rule in groups table which should trigger only for sys_ref_list
view.
refer below script
if(gs.action.getGlideURI().getMap().get('sysparm_view')=='sys_ref_list'){
current.addQuery('checkboxfieldname',false); // will show only groups with that checkbox is false
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 11:19 PM
Thanks a lot. it's working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 10:44 PM
Hello @sagar0711 you can use a Business Rule to run server-side scripting when the checkbox is selected Here's an example script
(function executeRule(current, previous /*, gs */ ) {
// Check if the "Not Visible in Assignment Group" checkbox is selected
if (current.getValue('not_visible_in_assignment_group')) {
// Set the 'active' field to false to make the group not visible in assignment groups
current.setValue('active', false); // Optionally, you might want to clear any assignment group references current.setValue('assignment_group', ''); // Add any additional logic or actions based on your requirements }
})(current, previous);
This script should be in Business rule 'When condition set to 'before' and 'insert/update'. It checks if the "not visible in assignment group" is selected. If true, It sets the 'active' field to false and clears any assignment group references.
Hope this helps...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 10:48 PM
Hi @sagar0711
I think It is OOtb, means on group table there is field Calle Type, and you can create own types in that.
If field is not on form, you can bring via Form Layout.
Now you can go to assignments group dictionary entry and I reference qualifier you can mention which type of groups should a user see or available for selection.
Give a try and share feedback.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2024 10:51 PM