Use the following script during the initial setup for Bitsight for IT Service Management by ServiceNow to retrieve historical findings from a specific date.
- Configure the settings in the “Application Configuration” section.
- Navigate to “Data Import Job Schedules.”
- In the “Run this script” field, replace the current script with the script below:
var noDays = 389; //number of days from today’s date; change as desired var gdt = new GlideDateTime(); gdt.addDaysLocalTime(-(noDays)); var lastSeen = gdt.getLocalDate()+""; var gr = new GlideRecordSecure('x_bisit_connector_connector_configuration'); gr.query(); if(gr.next()){ var apiToken = gr.getValue('api_token'); if(apiToken){ var appFilters = gr.getValue('application_filters'); appFilters = JSON.parse(appFilters); appFilters["ITSM"].last_seen = lastSeen; gr.application_filters = JSON.stringify(appFilters); gr.update(); } } gs.info("BitSight Findings Import begin."); var script = new x_bisit_connector.ImportScript(); script.importFindings(); gs.info("BitSight Findings Import complete.");
The completed script will look like the screenshot below: - Save the changes and select the Execute Now button.
Once complete, modify the noDays
value to 2
and save the script.
October 25, 2021: Published.
Feedback
0 comments
Please sign in to leave a comment.