
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 05:07 AM
Hi!
We are getting a task created in each metric results (Duplicate, Orphan, Stale) and I'm wondering how these tasks are created as I cannot find where and/or how are they being created? I've noticed that some CI of the class name we have tasks created on them and some doesn't. I tried to replicate the issue in PDI and turn on the Task creation tab on the Health Preference module and it does create the tasks, then I've turned it off and no further tasks were created in my PDI. However when the dashboard is run again on our dev instance there are still tasks created even if the task creation tab is already off in our Health Preference module.
Can anyone advise as to how and/or where can I further check the trigger for the task creation in CMDB Health Result?
I have attached screenshots below from my PDI for reference. Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 03:09 AM
Definitely you can do that, and I would suggest doing that only as it is not a good practice to delete records on the platform unless if it is really needed to do it.
Just Update your script as below and you should be good:
removeTask();
function removeTask(){
var gr = new GlideRecord('stale_ci_remediation'); // Change it to your Table Name where task is present if needed
gr.addEncodedQuery('state=1'); // This will run only for Open Records
gr.query();
while(gr.next()){
gr.state = 3; // Value for Closed Complete
gr.update();
}
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 02:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 03:09 AM
Definitely you can do that, and I would suggest doing that only as it is not a good practice to delete records on the platform unless if it is really needed to do it.
Just Update your script as below and you should be good:
removeTask();
function removeTask(){
var gr = new GlideRecord('stale_ci_remediation'); // Change it to your Table Name where task is present if needed
gr.addEncodedQuery('state=1'); // This will run only for Open Records
gr.query();
while(gr.next()){
gr.state = 3; // Value for Closed Complete
gr.update();
}
}
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2022 04:52 AM
You're amazing
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-07-2022 06:34 AM
Glad to help 🙂
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-06-2022 07:00 AM
Thanks for the suggestion