- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2019 11:48 PM
Hello Folks,
My very first post on the platform, a fairly new person to ServiceNow; especially when it is about something that is not out-the-box.
I have a request where the customer wants to have the following done when a vulnerable item is identified:
WHEN a vulnerability is identified
THEN automatically assign the vulnerability remediation task to the support group that is responsible for supporting the business service associated with vulnerable CIs.
So I basically need to write something that would go ahead and look for the support group that supports the business service that is associated with the CI.
Hope I have been able to put it down here in plain english.
Would appreciate the support.
Solved! Go to Solution.
- Labels:
-
Vulnerability Response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2019 10:17 AM
No. There wont be any such scripts. You will need to write it on your own. Because it all depends on how your CMDB relationships are created.
You need to query the cmdb_rel_ci table and find out the corresponding Application and then from Application find out the corresponding Business Service.
For ex
answer = '';
//Query the Application
var rel1 = new GlideRecord('cmdb_rel_ci');
rel1.addQuery('child',current.cmdb_ci);
rel1.addQuery('parent.sys_class_name','cmdb_ci_appl');
rel1.query();
if (rel1.next())
{
//Query the Business Service
var rel1 = new GlideRecord('cmdb_rel_ci');
rel1.addQuery('child',rel1.parent);
rel1.addQuery('parent.sys_class_name','cmdb_ci_service');
rel1.query();
if (rel1.next())
{
answer = rel1.parent.support_group; // assign the support group of Business service
}
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2019 12:36 AM
Like our usual Assigntment lookup rules, you will be able to define conditions to search and get values.
OR You can write a script which will search the Business Service record for support group information and save it. Please note this is very much required to have complete data in Business Service record for Support group else you will have to make a more complex query.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2019 12:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2019 01:36 AM
Thanks Sanjiv and Sankalp for your feedback.
I very much realise that this will require a script to lookup the record. Still trying to find my way around the resources developer community has to offer. Is there a repository of useful scripts that can be used by community users?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2019 10:17 AM
No. There wont be any such scripts. You will need to write it on your own. Because it all depends on how your CMDB relationships are created.
You need to query the cmdb_rel_ci table and find out the corresponding Application and then from Application find out the corresponding Business Service.
For ex
answer = '';
//Query the Application
var rel1 = new GlideRecord('cmdb_rel_ci');
rel1.addQuery('child',current.cmdb_ci);
rel1.addQuery('parent.sys_class_name','cmdb_ci_appl');
rel1.query();
if (rel1.next())
{
//Query the Business Service
var rel1 = new GlideRecord('cmdb_rel_ci');
rel1.addQuery('child',rel1.parent);
rel1.addQuery('parent.sys_class_name','cmdb_ci_service');
rel1.query();
if (rel1.next())
{
answer = rel1.parent.support_group; // assign the support group of Business service
}
}
Please mark this response as correct or helpful if it assisted you with your question.