
- 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-05-2022 03:18 AM
Hi,
This is controlled using "CMDB Health Metric preferences". So in order to switch this Task creation you need to follow below steps:
1) Navigate to the module "Health preference" as shown below:
2) Click on "Health Metrics" on right side of the Page which open up as shown below:
3) Select Metric as "Staleness" as shown below and make sure to switch off the toggle for Create task as shown below:
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-05-2022 03:22 AM
Hi
Also to note the above solution given by me should work for you. In case if it does not work then you can follow the steps below to switch off the Task creation:
1) Type in "cmdb_health_metric_pref.LIST" in Application Navigator search menu as shown below and hit Enter on your Keyboard:
2) Once the page open there are lot of metrics which are defined here and this is the Table which controls whether a Task will be created or not , so you can make the Create Task as False for the metric you want.
Looking at your screenshot it looks like you want to switch of Staleness Task metric so that it does not create Task so make it as False as shown below:
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-05-2022 04:39 AM
Hi
I did checked those 2 settings, all 3 sub-metrics are already off and there seems to be no new tasks being created except on the Duplicate metric which has a duplicate task created today. Right now, it appears that the old tasks that were previously created were still captured in the CMDB Health Dashboard.
What is the best way to close all of them at once as there are more than 700,000 tasks that were already created and are still open. I've created a remediation rule to automatically close the tasks however it only seems to work on the newly created tasks but not on the existing created ones and you will need to manually open each tasks and hit the remediate button (which is not ideal to do for 700k tasks). I tried to rerun the health jobs but it doesn't seem to close the existing tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2022 05:46 AM
Hi,
You can make use of Fix script here as it is a one time activity. Reason for using Fix script is it allows you to run it in Background and will not impact the current user session on the instance.
Please use the below script which will close all the existing task for you and let me know if you are stuck:
Navigate to Fix Script module as shown below:
removeTask();
function removeTask(){
var gr = new GlideRecord('stale_ci_remediation'); // Change it to your Table Name where task is present if needed
gr.addEncodedQuery('Put your query here which you want to delete records for');
gr.query();
gr.deleteMultiple();
}
Now click on Run Fix Script button and Select "Proceed in background" as shown below:
Note: Please do this for few record first just to ensure you are deleting the correct set of records and then do it for all 700K.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke