We currently have a Condition called "Are all Assigned Tasks at End State?", which allows the Resolve action to be present if true. Recently, we came across an Incident which was Resolved, but it had an open Child with an open Task. Normally, we can Resolve the Parent, which will close all the Children. In this case it allowed the Child to stay open due to the Task being open.
I'm looking for a calculation that will check not only the Incident, but also any Children (if exists) for any open Tasks. This way we can prevent the Resolve action from being available.
The current calculation we have to check the Incident for any open Tasks is:
import System
static def GetAttributeValue(Incident):
Value = true
if Incident.Tasks.Count > 0:
for task in Incident.Tasks:
if task.Lifecycle.Title == 'Assigned Task' and task.Status.IsEnd == false:
Value = false
return Value
Would the following calculation work to first check if the Incident has any Children, then to check to make sure all Child Tasks are completed?
import System
static def GetAttributeValue(Incident):
Value = true
if Incident.Children.Count > 0:
if Incident.Children.Child.Tasks.Count > 0:
for task in Incident.Children.Child.Tasks:
if task.Lifecycle.Title == 'Assigned Task' and task.Status.IsEnd == false:
Value = false
elif Incident.Tasks.Count > 0:
for task in Incident.Tasks:
if task.Lifecycle.Title == 'Assigned Task' and task.Status.IsEnd == false:
Value = false
elif Incident.Tasks.Count > 0:
for task in Incident.Tasks:
if task.Lifecycle.Title == 'Assigned Task' and task.Status.IsEnd == false:
Value = false
return Value