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
‎12-13-2017 10:41 PM
Hi Shikha,
You need to use GlideAjax if you want to call script include from client script.
Example below:
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 11:34 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2017 02:16 AM
Script Include to get all group sysids,
var groupSysID = Class.create();
groupSysID.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getAssignmentGroupSysID : function(){
var assignmentGroupArray = [];
var assignmentGroupName = [];
var gr = new GlideRecord('sys_user_group');
gr.addQuery('active',true);
gr.query();
while(gr.next()){
assignmentGroupName.push(gr.getUniqueValue());
}
return assignmentGroupName.toString();
},
type: 'groupSysID'
});
Client script to get values,
For testing I have set the values in description, you change the logic as you need.
function onLoad() {
//Type appropriate comment here, and begin script below
var ga = new GlideAjax('groupSysID');
ga.addParam('sysparm_name', 'getAssignmentGroupSysID');
ga.getXML(AssignmentGrpupSysID);
}
function AssignmentGrpupSysID(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
g_form.setValue('description', answer);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-20-2017 05:03 AM
Hi Shikha,
Any update on this?
Can you mark answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader