Changing the Json script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 06:02 PM
Can anyone help me out here
I need to work on a requirement
There is field called "source data" in discovered items table,where we need to replace the line 'Assessed for Vulnerabilities:false' as 'Assessed Vulnerabilities:true' value in the Json value as identified during the discovery stage..

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 06:28 PM
@Mahesh137 Here is how you can update the JSON value in database.
var glideIRE = new GlideRecord('cmdb_ire_output_target_item'); //add your table na,e here
glideIRE.query();
//glideIRE.addQuery(); add your filters here
if(glideIRE.next())
{
var jsonVal = JSON.parse(glideIRE.getValue('source_data')); //
//gs.print(jsonVal.);
if(jsonVal['Assessed for Vulnerabilities']){
var assess=jsonVal['Assessed for Vulnerabilities'];
if(assess=='false'){
jsonVal['Assessed for Vulnerabilities']='true';
glideIRE.setValue('source_data',JSON.stringify(jsonVal));
glideIRE.update();
}
}
}
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2024 07:01 AM
Hey there,
The 'Source Data' on the Discovered Item is a collection of data objects that is put together using the data from the upstream integration vulnerability scanner tool.
Those values you see in there come in through the data payload - as each asset is imported from the vulnerability scanning tool.
Which vulnerability scanning tool are you using today, to integration with SecOps (e.g. Qualys, Rapid7, Microsoft, Tenable, etc.)
Is your goal, in turn actually to filter the assets you are bringing into ServiceNow from the Vulnerability Scanner - to limit it to assets that have "Assessed Vulnerabilities: True" -- and then omit or exclude bringing in assets with "Assessed Vulnerabilities: False"?