Auto populate Assignment Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:59 AM - edited 10-06-2022 08:04 AM
Hi All,
We are populating assignment group on incident form based on the CI that was selected on form (From "cmdb_rel_group" table). Below are the scripts that were written for the same.
Client script: On Change on Incident Table
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//if (isLoading || newValue === '') {
if (newValue === '') {
return;
}
var ga = new GlideAjax('SetAssignmentGroup'); //script include name
ga.addParam('sysparm_name', 'populateAssignmentGroup'); //script include function name
ga.addParam('sysparm_cmdb_ci', g_form.getValue('cmdb_ci')); //parameter passeed
ga.getXML(getResponse);
function getResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('assignment_group', answer);
}
}
Script Include:
var SetAssignmentGroup = Class.create();
SetAssignmentGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
populateAssignmentGroup : function(){
var gr=new GlideRecord('cmdb_rel_group');
gr.addQuery('ci',this.getParameter('sysparm_cmdb_ci'));
gr.query();
if(gr.next())
{
return gr.group;
}
},
type: 'SetAssignmentGroup'
});
So, the assignment group is automatically populating based on the ci that was selected on the incident form. And We need this functionality to work even for an inbound integration with another ServiceNow instance.
The group is automatically populating whenever an incident is created through integration. But, now the problem is we are unable to populate the assignment group whenever we update the incident through inbound integration, the form is not getting saved/updated. So, we can see the value on the form but the value is not changing from the incident's list view and also unable to see it in the history as well.
Any solution is appreciated.
Please help.
Thanks,
Priya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 02:15 AM - edited 10-07-2022 02:18 AM
Hi Patrick,
Will the OOTB assignment rules work for integrations as well ? and can we save/update the record after populating the group on form?
Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 07:22 AM
Priyarao,
Assignment rules are the way to go.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 07:56 AM
Hi Priya,
Just use OOTB assignment lookup rules.
below is the example.
create a rule with CI information and what group to populate.
and you can see on incident form it will populate based on CI selected.
Please mark helpful if my solution helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2022 01:14 AM
Hi,
I think you can achieve your goal using a flow.
If I understand it properly, you want the assignment group to be populated whenever the "Configuration item" field is populated (or changed), correct?
If that's the case, I think you can try with a flow that looks like this.
- In the trigger you should select the right condition. In your case "Assignment Group" is empty.
- In the look up action you look up in your cmdb table with a condition like "Configuration Item" = the configuration item in the incident you have selected in the trigger
- In the Update action, you should update the assignment group of the incident you selected in the trigger with the assignment group you have (I assume) mapped in your cmdb table.
Cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2022 03:52 AM
Hi @Joshuu ,
Client scripts will not work for Inbound integrations.
You can achieve using Async Business rule.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar