The "Discovery CI schedule Manager > CI Schedules" may display incorrect state of schedules. Schedules may display as "Running" when in fact there are no active discoveries for such schedule. 

Steps to Reproduce


  1. Create a discovery_result record where "Ended" = null and populate the discovery_schedule field with a valid schedule. For the same schedule confirm there are no active discoveries.
  2. Open "Discovery CI schedule Manager > CI Schedules".
  3. Check the left column showing the state of the schedule, which is displayed incorrectly as "Running".


There are three possible solutions to the issue.

Solution A:

  1. Find the schedule with incorrect state of "Running."
  2. Populate the "Ended" date for discovery_result where state = "Starting."

Solution B:

  1. Find the schedule with incorrect state of "Running."
  2. Delete discovery_result records where "Ended" = null and state = "Starting."

Solution C:

With the New York release, a Business Rule cleans up the Discovery results when any Discovery status is deleted. The scheduled jobs existing over “discovery_status” and “discovery_results” table help to clear off the abandoned data that is no longer in use (i.e., when no discovery status is associated).

Import this into your instance.

<?xml version="1.0" encoding="UTF-8"?><record_update sys_domain="global" table="sys_script">
<sys_script action="INSERT_OR_UPDATE">
<condition>current.state == 'Completed' || current.state == 'Canceled'</condition>
<description>Used to delete the respective record from discovery_result table before deleting a Completed or Canceled discovery status</description>
<name>Delete discovery result on status delete</name>
<script><![CDATA[(function executeRule(current, previous /*null when async*/) {

var gr = new GlideRecord('discovery_result');
gr.query('status', current.sys_id + '');

})(current, previous);]]></script>
<sys_created_on>2019-04-09 11:04:20</sys_created_on>
<sys_name>Delete discovery result on status delete</sys_name>
<sys_package display_value="Global" source="global">global</sys_package>
<sys_scope display_value="Global">global</sys_scope>
<sys_updated_on>2019-04-09 11:04:20</sys_updated_on>
<sys_translated_text action="delete_multiple" query="documentkey=a04436cc6730330022646c706785ef9f"/>


Related Problem: PRB1322805

Seen In

There is no data to report.

Intended Fix Version

New York

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-05-21 11:43:36