For Task SLAs that have a schedule associated with them, the "Actual elapsed percentage" field can present negative values when the "Pause duration" is greater than the difference between "Breach time" and "Start time."

Steps to Reproduce

  1. Create a new Schedule record so that there is only approximately 3 or 4 minutes of scheduled time left for today.
    For example, if the time is 16:00, add a schedule entry that starts at 16:00 and ends at 16:04.
  2. Create a new SLA Definition record with the following values:
    • Duration: 10 seconds
    • Start condition: Active is true
    • Stop condition: Active is false
    • Pause condition: State is Awaiting User Info
  3. Create a new incident.
  4. Wait for 15 second to breach the SLA.
  5. Set the state of the incident to Awaiting User Info to pause the SLA.
  6. Save the incident.
  7. Wait for the end of the schedule to pass and some time larger than the definition time.
    For example, 16:04 is schedule end and wait a further 20 seconds.
  8. Set the state of the incident to Active.
  9. Save the incident.
  10. Select the SLA.
  11. Click Recalculate.
    Note the Actual percentage is recalculated and is negative.


In the script include SLACalculatorNG, the script calculates the percentage as follows:

currentSLA.percentage = ((currentSLA.elapsed / (currentSLA.elapsed + timeLeftMS)) * 100).toFixed('2');

Comment out this line and add the following 4 lines below it. This introduces a test to determine if the pause duration or business pause duration should be used when calculating the percentage:

if ((currentSLA.derived_end_time - currentSLA.start_time) < currentSLA.pause_duration)
    currentSLA.percentage = ((currentSLA.elapsed / (currentSLA.derived_end_time - currentSLA.start_time - currentSLA.business_pause_duration)) * 100).toFixed('2');
    currentSLA.percentage = ((currentSLA.elapsed / (currentSLA.derived_end_time - currentSLA.start_time - currentSLA.pause_duration)) * 100).toFixed('2'); 

Related Problem: PRB609211

Seen In

Calgary Patch 3 Hot Fix 1
Eureka Patch 11 Hot Fix 2
Eureka Patch 13 Hot Fix 2
Eureka Patch 13 Hot Fix 5
Eureka Patch 2
Eureka Patch 6
Eureka Patch 9 Hot Fix 4
Fuji Patch 7 Hot Fix 3
Fuji Patch 8

Fixed In

Fuji Patch 10

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2016-10-31 14:41:35