Automatic Assignment of Support Groups based on Business Service associate with CI

Imran Minhas
Kilo Contributor

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. 

1 ACCEPTED SOLUTION

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.

View solution in original post

7 REPLIES 7

Inactive_Use945
Kilo Expert

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.

SanjivMeher
Kilo Patron
Kilo Patron

You can use Vulnerability assignment rule for this and use a script to identify assignment based on business service.

 

find_real_file.png


Please mark this response as correct or helpful if it assisted you with your question.

Imran Minhas
Kilo Contributor

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?

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.