How to get the "Breach Time" attribute value on a Process Query.

Version 3

    Environment:

    Service Desk 7.4 and newer

     

     

    The Breach Time attribute added to the Incident, Problem, Change, Call and associated Task objects is a hardcoded DateTime that displays when an item is due to breach.  There are calculations functions to return the time to breach as an integer ( MinutesToBreach() ) or as a string in hh:mm:ss format ( TimeToBreach() ) which you can use on the Process object but you can't get the hardcoded Breach Time and you may want this if you have queries based on the Process object rather than Incident, Problem etc...

     

    To overcome this you can create a calculation that takes the attribute from the child object on the fly.  Perform the following steps:

     

    1. Within Object Designer open the Process Management -> Process object.

    2. Create a new attribute, name it Process Breach Time.

    3. Set the data type to Datetime.

     

    calculation3.png

     

    4. Set the calculation type to AfterRead.  The calculation editor dialog will open.

    5. Configure the formula as below:

     

    import System
    static def GetAttributeValue(Process):
         return Process.BreachTime
    

    calculation4.png

     

     

    The Breach Time attribute is not displayed in the attributes tree but typing it manually will work because the attribute is available and the same attribute name is used on all child objects of Process.

     

    6. Press OK and save Object Designer.

     

    You can now use the Process Breach Time attibute on queries based on the Process object and it will use the value from the items Breach Time attribute.

     

    Note: Because this is an AfterRead calculation there is a potential for performance to be effected while the calculation is applied if a large number of items are being returned at once.  You should attempt the above on a test environment and fully test what effects it may have before applying to a live system.