Where in the system is Problem Tasks getting closed when Accept Risk is clicked?

TrenaFritsche
Tera Expert

I have a requirement to not close open problem tasks when a problem has the "Accept Risk" button clicked.  This UI Action calls scripts using ProblemModalUIHelpers:

if (g_form && g_form.mandatoryCheck()) {
ScriptLoader.getScripts("ProblemModalUIHelpers.jsdbx", function() {
ProblemModalUIHelpers.onAcceptingRisk();
});
}

I tried to read the UI Script to see if problem tasks were closed from the onAcceptingRisk function, but it doesn't look like it.  I am unable to find where this occurs.  Once I get that figured out, I will be in a better position in deciding how to prevent them from getting closed.  Any help would be much appreciated.

Thanks!

1 ACCEPTED SOLUTION

Hi Trena,

In a baseline instance, I can see that the sys_properties table contains this property - try navigating to this link by replacing ***yourinstance*** with the url for your instance. Otherwise, navigate to the System Properties table by entering sys_properties.list into the Filter Navigator, and search for that property.

The business rule governing the function is found on the Problem table, and is named 'Cascade closure of Problem Tasks', which runs when State = Closed. It's functionality is outlined below:

Condition: gs.getProperty("problem.closed.cancel_open_tasks") == "true"

(function executeRule(current, previous /*null when async*/) {

	var PRB_TASK_CLOSED_STATE = ProblemTaskState.States.CLOSED;
	var problemTaskGr = new GlideRecord("problem_task");
	problemTaskGr.addQuery("problem", current.getUniqueValue());
	problemTaskGr.addActiveQuery();
	problemTaskGr.setValue("state", PRB_TASK_CLOSED_STATE);
	problemTaskGr.setValue("close_code", "canceled");
	problemTaskGr.setValue("close_notes", gs.getMessage("Problem Task is Canceled based on closure of {0}.", current.getDisplayValue()));
	problemTaskGr.updateMultiple();

})(current, previous);

Again, this is the baseline configuration but it is leveraging the system property I referred to, grabbing the state from the ProblemTaskState Script Include, and then iterating against all the records where the problem task is related to the problem.

The mitigation is simply toggling the property from true to false, which will mean the BR won't close the records.

Please let me know if you'd like further clarification.

Kind Regards,

Astrid Sapphire

View solution in original post

8 REPLIES 8

There is a BR "Cascade closure of Problem Tasks" on the problem that runs after the problem is closed.

It explains why the Problem tasks are getting closed. @Astrid Sapphire  has elaborated on this.

 

Thank you.

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Astrid Sapphir1
Giga Expert

Hi,

This is governed by a system property:

 problem.closed.cancel_open_tasks

Perhaps in concert with another property where 'Accept Risk' moves the problem to closed.

See here for more detail: Problem Management Properties

Toggling this property would stop the action. While I haven't investigated the table in detail I would presume that Problem has a business rule to close child tasks if the above property is true. That will leverage a script include likely built by ServiceNow to handle that. Change and Incident tasks have similar functionality.

I would recommend modifying that property to meet your requirements. 

Kind Regards, 

Astrid

Thanks Astrid.  I have performed a global search for that property and I've search in the scripts of Script Include and UI Scripts with no reference to it.  I would definitely like to find the flow that is causing the tasks to close when that property is true.  Any ideas?

Hi Trena,

In a baseline instance, I can see that the sys_properties table contains this property - try navigating to this link by replacing ***yourinstance*** with the url for your instance. Otherwise, navigate to the System Properties table by entering sys_properties.list into the Filter Navigator, and search for that property.

The business rule governing the function is found on the Problem table, and is named 'Cascade closure of Problem Tasks', which runs when State = Closed. It's functionality is outlined below:

Condition: gs.getProperty("problem.closed.cancel_open_tasks") == "true"

(function executeRule(current, previous /*null when async*/) {

	var PRB_TASK_CLOSED_STATE = ProblemTaskState.States.CLOSED;
	var problemTaskGr = new GlideRecord("problem_task");
	problemTaskGr.addQuery("problem", current.getUniqueValue());
	problemTaskGr.addActiveQuery();
	problemTaskGr.setValue("state", PRB_TASK_CLOSED_STATE);
	problemTaskGr.setValue("close_code", "canceled");
	problemTaskGr.setValue("close_notes", gs.getMessage("Problem Task is Canceled based on closure of {0}.", current.getDisplayValue()));
	problemTaskGr.updateMultiple();

})(current, previous);

Again, this is the baseline configuration but it is leveraging the system property I referred to, grabbing the state from the ProblemTaskState Script Include, and then iterating against all the records where the problem task is related to the problem.

The mitigation is simply toggling the property from true to false, which will mean the BR won't close the records.

Please let me know if you'd like further clarification.

Kind Regards,

Astrid Sapphire