This example demonstrates how to add a field to the Incident window that reports how much time is left before the incident breaches its service level.
To calculate the time to breach for an incident:
In Object Designer, create a string attribute on the Incident Management\Incident object called Time to Breach.
In the Properties grid, set the Calculation Type to AfterRead. The Edit Formula dialog appears. For this calculation, we are going to use a function that returns the result of the calculation, so we do not need the Value = line.
Delete the line that reads Value =
Delete the word Value from the return line.
Type a single space after return, then in the Functions tree, double-click TimeToBreach() from the Framework Object Functions branch. The calculation reads:
static def GetAttributeValue(Incident):
Click Test Syntax to confirm that the calculation contains no errors in its structure, then click OK. The Calculation is added to the attribute.
Save the changes to the object, then start Window Manager.
Open the Incident window, and add the attribute Time to Breach. This field will report the time remaining until the incident breaches.
If the service level clock is stopped (for example, when you use the With Customer action), the time to breach can no longer be determined. In these cases, the time to breach functions return no value (null).