Notifications

134 views

Description

Business Rule 'Discovery - Device Complete' does not handle a null value for g_device well. This causes the variable 'deviceHistory' to be initiated as null and causes the below error in the system logs.

Error :
org.mozilla.javascript.EcmaError: Cannot convert null to an object.
Caused by error in sys_script.35043aa54a36231d0022ba06e63beffd.script at line 2

1: var deviceHistory = (typeof g_device != 'undefined') ? g_device : SncDeviceHistory.getFromSourceAndStatus(current.source, current.status);
==> 2: var shouldFireAdm = deviceHistory.getScratchpadValue('requires_adm') == 'true';
3:
4: if (shouldFireAdm)
5: fireAdm();

Steps to Reproduce

There are no fixed step to reproduce. However, the issue is visible if g_device as null for any reason.

  1. Perform discovery for a device such that g_device is initialized as null.
  2. Review the System Logs.

Workaround

The solution implemented is to:

  1. Revert the Script Include 'Discovery - Device Complete' back to OOTB
  2. Modify the Business Rule as below:

=====Original=====
var deviceHistory = (typeof g_device != 'undefined') ? g_device : SncDeviceHistory.getFromSourceAndStatus(current.source, current.status);
var shouldFireAdm = deviceHistory.getScratchpadValue('requires_adm') == 'true';

======Modified=====
var deviceHistory = ((typeof g_device !== 'undefined') && (g_device != null) ? g_device : SncDeviceHistory.getFromSourceAndStatus(current.source, current.status);
var shouldFireAdm = deviceHistory.getScratchpadValue('requires_adm') == 'true';


Related Problem: PRB1387469

Seen In

SR - IRM - Audit Management - New York 2019 Q3
SR - IRM - Audit Management PA Content - Madrid 2019 Q1
SR - IRM - GRC Profiles - Madrid 2019 Q2
SR - IRM - GRC Workbench - New York 2019 Q3
SR - IRM - PA Premium Integration - New York 2019 Q3
SR - IRM - Policy and Compliance - Madrid 2019 Q2
SR - IRM - Policy and Compliance PA Content - Madrid 2019 Q1
SR - IRM - Risk Management - New York 2019 Q3
SR - IRM - Risk Management PA Content - Madrid 2019 Q1

Intended Fix Version

Paris

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:2020-03-11 06:53:16
Published:2020-02-24