5 Replies Latest reply on Apr 21, 2017 6:47 AM by foremans

    Calculated pre-condition

    foremans Apprentice

      I am trying to create a calculated pre-condition to prevent incidents from being reopened after 5 business days. I have a calculation that makes sense to me but when I try to implement it, I get an XML error on closed incidents.


      import System

      static def GetAttributeValue(Incident):

        Expired = 'True'

        if Incident.Status.Title == 'Closed':

        ClosureTime = Incident.Closures.LastUpdate()

        TimeSinceClosure = Incident.GetBusinessTime(ClosureTime.CreationDate, DateTime.UtcNow)

        if TimeSinceClosure.TotalHours < 40:

        if DateTime.Today.DayOfWeek != DayOfWeek.Saturday and DateTime.Today.DayOfWeek != DayOfWeek.Sunday:

        Expired = 'False'

        return Expired



      Any ideas or is this something that can't be done?