write a script include to get sysid of assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 10:20 PM
i want to write a script include to get the sysids of assignment groups and than call that script include in client script.
need example.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 12:36 PM
I'm curious: why doesn't this exist out of box? If the name of a sys_user_group is unique, then it would seem pretty straight-forward to have one call (a la gs.getUserID()) to get the sys_id of a specified group name, no? (@Chuck Tomasi)
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 12:46 PM
I had a slightly different need: just tell me the sys_id of a specified group name. Here's my code:
var GetGroupSysIDAjax = Class.create();
GetGroupSysIDAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignmentGroupSysID : function(gr_name){
var gr = new GlideRecord('sys_user_group');
gr.addActiveQuery();
gr.addQuery('name', gr_name);
gr.query();
if (gr.next())
return gr.getUniqueValue();
},
type: 'GetGroupSysIDAjax'
});
Put that in a client callable script include named "GetGroupSysIDAjax" and call it as follows:
gr.assignment_group = new GetGroupSysIDAjax().getAssignmentGroupSysID('Service Desk');