CMDB Health Result Tasks Creation

Rowella Montell
Tera Contributor

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!

1 ACCEPTED SOLUTION

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

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

12 REPLIES 12

Hi @shloke04 

 

Thank you for sharing this method, I wasn't aware you can use it to run a script once. Can you also use it if we want to update the Task state from Open to Closed Incomplete instead of deleting them?

find_real_file.png

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

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

You're amazing @shloke04 

Thank you!

Glad to help 🙂

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Thanks for the suggestion