Scripted Audit and Follow On Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2019 01:55 AM
Hi,
I'm playing around with Scripted Audits.
Hard to find any detailed documentation/examples how to do this, but using the commented example:
/////////////////////////////////////////////////////
/// This script works with Data Center Zones filter //
/////////////////////////////////////////////////////
var desiredFloorSpaceUsage = 30; // Value to audit against
var assignToUser = '46d44a23a9fe19810012d100cca80666'; // Beth Anglin
var assignToGroup = '8a5055c9c61122780043563ef53438e3'; // Hardware group
var taskMsg = 'See the audit results below for the discrepancies that must be addressed';
// API call to retrieve records based on the filter
var gr = new SNC.CertificationProcessing().getFilterRecords(current.filter);
// Loop over all records defined by the filter
while(gr.next()) {
var sysId = gr.getValue('sys_id'); // Sys ID of audited record
var floorSpaceInUse = gr.getValue('floor_space_in_use'); // Value to audit
// Determine if certification condition passes or fails
if (floorSpaceInUse < desiredFloorSpaceUsage) {
var columnNameSpace = gr.floor_space_in_use.getLabel(); // String value of column audited against
// Call create Follow on Task API and save the returned sys_id for use in logging audit result fail
// Params:
// auditId - Sys id of the audit record executed
// ciId Sys - id of the configuration item. Empty string if not a cmdb ci
// assignedTo - Sys id of user to assign task to. Can be empty
// assignmentGroup - Sys id of group to assign task to. Can be empty
// shortDescr - Short description for the Follow On Task. Can be empty
// Return value: Sys id of the created follow on task
var followOnTask = new SNC.CertificationProcessing().createFollowOnTask(current.sys_id, sysId, assignToUser, '', taskMsg);
// Call log failed result API
// Params:
// 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(@see auditedRecordId). Can be empty
// columnDisplayName - Label of the column audited(ex. Disk space (GB)). Can be empty
// operatorLabel - Label of the operator used to audit the column(ex. is not empty, greater than). Can be empty
// desiredValue - Desired value of the column. Can be empty
// discrepancyValue - Discrepancy value. Can be empty
// isCI - True, if audited record is a CI. False, otherwise.
// domainToUse - Sys domain of the "cert_audit" record. Can be empty
new SNC.CertificationProcessing().logAuditResultFail(current.sys_id, sysId, followOnTask, columnNameSpace, 'greater than', desiredFloorSpaceUsage, floorSpaceInUse, true);
} else { // If certification condition pass, write a Audit Result Pass via API
// Params:
// auditId - Sys id of audit record executed
// auditedRecordId - Sys id of the record audited
// isCI - True, if audited record is a CI. False, otherwise. Can be empty.
// domainToUse - Sys domain of the "cert_audit" record. Can be empty.
new SNC.CertificationProcessing().logAuditResultPass(current.sys_id, sysId, true);
}
}
*/
I'm able to create some Audit Results.
But how do I avoid the Follow On Tasks being created in table cert_follow_on_task ?
Even if this is not checked:
It creates a record in cert_follow_on_task for each record the script checks.
And even if I remove the 3rd parameter for the followOnTask:
Like this:
It creates the records in cert_follow_on_task.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2019 11:27 PM
Nobody having experience with scripted audit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2020 06:15 AM
Hi
The system attribute "glide.allow.new.cert_follow_on_task" is set to true by default, allowing for new follow on tasks to be created for the same failure, at each audit run. You can set this property to false, to configure audit to use the same follow-on task for the same audit failure across multiple runs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2020 07:05 AM
This setting does not appear to apply to Scripted Audits.
I've used it on normal template-based audits and it works as expected.
When I tried my first scripted audit using the same OOB example as above (modified of course), each run of the audit produced new follow-on tasks for the same failure.
We'll probably have to include a check for existing follow-on tasks in our script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2020 08:13 AM
Hi,
Did you get any solution?
Can you please help me with the info you are having regarding scripted audits, as i am also not getting so much details in docs.
My requirement is to re-mediate discrepancies without creating tasks.