Script methods

ServiceNow provides four methods for creating the audit script.

Table 1. Script methods
Name Description Parameters
getFilterRecords public GlideRecord getFilterRecords(String filterId) filterID: The sys_id of the filter to use.
logAuditResultPass public void logAuditResultPass(String auditId, String auditedRecordId, boolean isCI, String domainToUse)

auditId: Sys_id of audit record executed

auditedRecordId: Sys_id of the record audited.

isCI: True, if the audited record is a CI, false if otherwise.

domainToUse: Sys_domain of the cert_audit record.

logAuditResultFail public void logAuditResultFail(String auditId, String auditedRecordId, String followOnTask, String columnDisplayName, String operatorLabel, String desiredValue, String discrepancyValue, boolean isCI, String domainToUse)

auditId: Sys_id of audit record executed.

auditedRecordId: Sys_id of the record audited.

followOnTask: Sys_id of the follow-on task associated with the audited record and can be an empty string.

columnDisplayName: Label of the column audited. For example, Disk space (GB).

operatorLabel: Label of the operator used to audit the column. For example, is not empty or greater than can be the label.

desiredValue: Desired value of the column.

discrepancyValue: Discrepancy value.

isCI: True, if the audited record is a CI, false if otherwise.

domainToUse: Sys_domain of the cert_audit record.

createFollowOnTask() public String createFollowOnTask(String auditId, String ciId, String assignedTo, String assignmentGroup, String shortDescr)

auditId: Sys_id of the audit record executed.

ciId: Sys_id of the configuration item. This string is empty when the table is not extended from the cmdb_ci table.

assignedTo: Sys_id of the assigned user of the task. This string can be empty.

assignmentGroup: Sys_id of the group the task is assigned to. This string can be empty.

shortDescr: The text to use for the short description of the follow-on task.