Script methods
ServiceNow provides four methods for creating the audit script.
| 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. |