Bitsight for IT Service Management by ServiceNow: SPM Connector Script

Use the following script during the initial setup for Bitsight for IT Service Management by ServiceNow to retrieve historical findings from a specific date.

  1. Configure the settings in the “Application Configuration” section.
  2. Navigate to “Data Import Job Schedules.”
  3. 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:
    Script Screenshot
  4. 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.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.