- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 05:56 AM
Assignment group should be auto populated in the Incident record, When Configuration item changes (Populate Configuration item Managed by group in the Incident Assignment group).
I'd really appreciate a descriptive walk through on how to solve it.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 06:14 AM
Try something as below as a scalable option.
1. Script include:
var getCIRelatedGroup = Class.create();
getCIRelatedGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
GetCIGroup: function() {
var ciselected = this.getParameter('sysparm_ci_grp');
var as = new GlideRecord('cmdb_ci');
as.addEncodedQuery('sys_id=' + ciselected );
as.query();
if (as.next()) {
return as.managed_by_group.toString(); //will return sys_id of group
}
},
type: 'getCIRelatedGroup'
});
2. Client script that runs onChange() of cmdb_ci field on incident form
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax("getCIRelatedGroup");
ga.addParam("sysparm_name", "GetCIGroup");
ga.addParam("sysparm_ci_grp", newValue);
ga.getXML(parseResponse);
}
function parseResponse(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('assignment_group', answer);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2022 06:17 AM
https://docs.servicenow.com/bundle/sandiego-platform-administration/page/administer/task-table/task/t_DataLookupRule.html