Notifications

138 views

Description

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".

Workaround

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">
   
<abort_action>false</abort_action>
   
<access>package_private</access>
   
<action_delete>true</action_delete>
   
<action_insert>false</action_insert>
   
<action_query>false</action_query>
   
<action_update>false</action_update>
   
<active>true</active>
   
<add_message>false</add_message>
   
<advanced>true</advanced>
   
<change_fields>false</change_fields>
   
<client_callable>false</client_callable>
   
<collection>discovery_status</collection>
   
<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>
   
<execute_function>false</execute_function>
   
<filter_condition/>
   
<is_rest>false</is_rest>
   
<message/>
   
<name>Delete discovery result on status delete</name>
   
<order>100</order>
   
<priority>100</priority>
   
<rest_method/>
   
<rest_method_text/>
   
<rest_service/>
   
<rest_service_text/>
   
<rest_variables/>
   
<role_conditions/>
   
<script><![CDATA[(function executeRule(current, previous /*null when async*/) {

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

})(current, previous);]]></script>
   
<sys_class_name>sys_script</sys_class_name>
   
<sys_created_by>srikanth.nelapudi</sys_created_by>
   
<sys_created_on>2019-04-09 11:04:20</sys_created_on>
   
<sys_domain>global</sys_domain>
   
<sys_domain_path>/</sys_domain_path>
   
<sys_id>a04436cc6730330022646c706785ef9f</sys_id>
   
<sys_mod_count>0</sys_mod_count>
   
<sys_name>Delete discovery result on status delete</sys_name>
   
<sys_overrides/>
   
<sys_package display_value="Global" source="global">global</sys_package>
   
<sys_policy/>
   
<sys_scope display_value="Global">global</sys_scope>
   
<sys_update_name>sys_script_a04436cc6730330022646c706785ef9f</sys_update_name>
   
<sys_updated_by>srikanth.nelapudi</sys_updated_by>
   
<sys_updated_on>2019-04-09 11:04:20</sys_updated_on>
   
<template/>
   
<when>before</when>
 
</sys_script>
 
<sys_translated_text action="delete_multiple" query="documentkey=a04436cc6730330022646c706785ef9f"/>
</record_update>

 


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
Published:2019-05-08