- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Could you please provide assistance for this to identify orphan CI
Where all CI status is installed and CI type is not empty and ownedby.active=false.
All the CIS which match the above filter condition and where Owned By.Active=False and Owned By.Dormant=False and OwnedBy.Deactivation Date Is not Empty should fail the certification and be marked as non-compliant CIs.
The audit should be run on daily basis and should executed @3AM CET
No Task creation required
the CIs which are in status installed are owned by user which is Active =False and Dormant=False are marked as non-compliant and as report as non-compliant CIs in the Compliance metrics of the CMDB Health Dashboard and as well each of the failed CIs must be available in cert_audit_result and the cmdb_health_result table bydefault as part of the standard Service Now process.
Please provide the assistance related to this requirement to design the solution.
(function executeAudit(current, answer) {
if (gs.nil(current.owned_by)){
return false;
}
var owner = current.owned_by.getRefRecord();
if (!owner || !owner.isValidRecord())
return false;
var inactive = owner.active == false;
// Replace with actual field names from sys_user
var dormant = owner.u_dormant == true;
var deactivationDate = owner.u_deactivation_date;
if (inactive &&
!dormant &&
!gs.nil(deactivationDate)) {
answer = false; // Non-compliant
return;
}
answer = true; // Compliant
})(current, answer);
This is the code i had used
But it is not executed and results are not coming in cert_audit_result.list table
Is there any mistake in the code could you please assist
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
52m ago
Hello @JinkaH,
Please refer to the link below:
Solved: Re: Best Practise to handle Orphan CIs - ServiceNow Community
If it is helpful, please mark it as helpful and accept the correct solution by refer to this solution in the future it will be helpful to them.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
52m ago
Hello @JinkaH,
Please refer to the link below:
Solved: Re: Best Practise to handle Orphan CIs - ServiceNow Community
If it is helpful, please mark it as helpful and accept the correct solution by refer to this solution in the future it will be helpful to them.
Thanks & Regards,
Abbas Shaik