Example of Assignment RuleS Script for Vulnerability Items

Jason Stuart
Tera Expert

Good Afternoon,

               I am looking to see if anyone has an example of scripts used for Assignment Rules for Vulnerability Items?  This is for the Vulnerability Assignment Rules.

Basically what I am looking to do is, if the Configuration Item you are targeting does not have a support group assigned, walk up the tree until you come to a configuration item that does have the support group set - and use that.

 

Thanks,

Jason

1 ACCEPTED SOLUTION

Chris McDevitt
ServiceNow Employee
ServiceNow Employee

Jason,

 

I understand now, a "parent/child" relationship. A Network Adapter has a Configuration Item field that references its Parent (another CI). 

I would check to see if your current ci is part of know class that has a Configuration Item Property:

current.cmdb_ci.sys_class_name=cmdb_ci_network_adapter
 
If true, then you should be able to reference it:
current.cmdb_ci.cmdb_ci.assignment_group.
 
or you could test to see if the fields exist: current.cmdb_ci.cmdb_ci should return a false value.
 
 
-Chris 

View solution in original post

9 REPLIES 9

Chris McDevitt
ServiceNow Employee
ServiceNow Employee

Jason,

 

The Assignment Rules that use the scripted assignment uses "current". So...

//basic assignment

var gid = "cfcbc3720ff55a80f9fb00dce1050e37”; // Identify Assignment Group by

current.assignment_group = gid; //Set the Assignment Group

 

I'm not sure how your plan would work. Let's look at a Windows Server:

find_real_file.png

A Windows Server is a Server. A Server is a Computer. A Computer is a Hardware. A Hardware is a Configuration Item.

Each layer extends its fields and the field of its parent to its child. So, the Assignment Group on Windows Server comes from the Configuration Item. There is only one Assignment Group set in the entire relationship. (i.e. The Assignment Group would IS identical when looking at that item regardless of if you look at it from the Configuration Item or Windows Server class)

 

Go ahead and mark this as helpful or Correct!

 

Thank you for the response.  I am referring to something - lets saw a switch port on an IP Switch.  Or anything down below a "Major" configuration item.

Chris McDevitt
ServiceNow Employee
ServiceNow Employee

Jason,

 

I understand now, a "parent/child" relationship. A Network Adapter has a Configuration Item field that references its Parent (another CI). 

I would check to see if your current ci is part of know class that has a Configuration Item Property:

current.cmdb_ci.sys_class_name=cmdb_ci_network_adapter
 
If true, then you should be able to reference it:
current.cmdb_ci.cmdb_ci.assignment_group.
 
or you could test to see if the fields exist: current.cmdb_ci.cmdb_ci should return a false value.
 
 
-Chris 

Thank you! This is a step in the right direction.