Created
December 11, 2023 14:49
-
-
Save cmcdevitt/4ddfa24e38e0f8effb1c14b6dbd47d53 to your computer and use it in GitHub Desktop.
VR Assignment Rule assign by script example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Vulnerability Response Assignment Rule -> Assign using Script | |
current.assignment_group = new global.VRUtil().arSVClookup(current.cmdb_ci); // ***Example Script*** | |
Note: | |
1. current.assignment_group #Note: If the lookup fails you ***NEED*** to return a default assignment group! | |
2. current.cmdb_ci you can use any property that "current" knows about, but typically its the CI | |
*/ | |
//Script Include, Example Method: | |
arSVClookup: function(current_rule) { | |
var rel_type = '60bc4e22c0a8010e01f074cbe6bd73c3'; //Runs on::Runs | |
//Default Support Group | |
var support_group = global.SecProperty.getProperty("vr_default_assignment_group", ""); | |
//Enterprise Vulnerability Mgmt "etg compliance security analysts" | |
var rel = new GlideRecord('cmdb_rel_ci'); | |
rel.addQuery('child', current_rule); | |
rel.addQuery('type', rel_type); | |
rel.addQuery('parent.sys_class_name', 'cmdb_ci_service_discovered'); //Only consider this type | |
rel.setLimit(1); | |
rel.query(); | |
while (rel.next()) { | |
if (rel.parent.support_group) { | |
support_group = rel.parent.support_group + ''; | |
} | |
} | |
return support_group; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment