How to filter services based on assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2024 10:23 PM
We have a requirement to filter services (cmdb_ci_service) whose names contain 'SAP' when the SAP assignment group is selected on an incident record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 10:48 PM - edited ‎11-19-2024 11:28 PM
Hi @ServiceNowL,
I would recommend to create a Reference Qualifier where you can script your condition and which returns filter query.
In Dictionary Override for field business_service in incident table set the Ref Qualifier:
Script Include to return the expected Services:
var TaskUtils = Class.create();
TaskUtils.prototype = Object.extendsObject(TaskUtilsSNC, {
/***************Custom changes****************/
getServiceQuery : function(current){
var query = "";
if(current.getDisplayValue("assignment_group").startsWith('SAP')){
query += "nameSTARTSWITHSAP";
}else{
query = this.getConfigurationItemFilter(current);
}
return query;
},
type: 'TaskUtils'
});
Result:
But I would suggest to build more robust logic. Why you don't maintain the support group in the Service or the Service Offering. Then you can query for Services which contains the selected Assignment group. This will help in future to deliver similar results for other assignment groups.
Maintain Support Group in Service or Offering:
And Change Code in Script Include to this:
var TaskUtils = Class.create();
TaskUtils.prototype = Object.extendsObject(TaskUtilsSNC, {
/***************Custom changes****************/
getServiceQuery : function(current){
var query = "";
if(JSUtil.notNil(current.assignment_group)){
query += "support_group=" + current.assignment_group;
}else{
query = this.getConfigurationItemFilter(current);
}
return query;
},
type: 'TaskUtils'
});
Greets
Daniel
Please mark reply as Helpful/Correct, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2024 10:58 PM
Good day,
wondering if this is based on a technical initiated incident (2nd line, alert, provider). Otherwise I am missing to understand the requirement.
Incidents created from consumer side in general do not know the assignment groups, they would be more familiar with Business Offerings. Then the Service will be the parent of the offering.
Can you elaborate the reasoning of the requirement?