- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 09:28 AM
I think I am close. I want to prevent a user from using an (inactive) value/name in the group. (Normally being pulled from their templates). Here is my script:
var gr = new GlideQuery('groups');
gr.addQuery('name',current.assignment_group.getDisplayValue());
gr.addQuery('active');
gr.query();
if (gr.active == false) {
gs.addInfoMessage('This group is not active, please update your template accordingly');
current.assignment_group.setError('This group is not active, please update your template accordingly');
current.setAbortAction(true);
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 02:41 PM
My bad. I found the error. It was line no 1
Here is the updated code.
var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id',current.assignment_group);
gr.addQuery('active', true);
gr.query();
if(!gr.next()) {
gs.addInfoMessage('This group is not active, please update your template accordingly');
current.assignment_group.setError('This group is not active, please update your template accordingly');
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 03:11 PM
That was it! Thank you again for walking me through this!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 03:12 PM
You are very welcome. Thanks for participating in the community!