Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Calculating the Planned end time of an SLA in the 2011 SLA Engine - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Calculating the Planned end time of an SLA in the 2011 SLA Engine
KB0550781

Calculating the Planned end time of an SLA in the 2011 SLA Engine


2263 Views Last updated : Jul 22, 2025 public Copy Permalink
KB Summary by Now Assist

Issue

In the 2011 SLA Engine, the Planned end time of an SLA needs to be calculated as follows:

  • When the task_sla record is first created

  • When the task_sla transitions from a Paused condition back to In Progress

The calculation is done in the TaskSLA script include in the _recalculateEndTime function. This function uses the DurationCalculator script include, which provides a variety of utilities for doing date arithmetic while factoring in schedules.

Keep in mind that the concept of business time is dependent on a schedule to define the work hours in question. In the absence of a schedule, the business time is the same as the actual time, calculated on a 24-hour day.

Calculation values

The calculation is straightforward, and is dependent on five values, all of which are copied into the task_sla record:

  • The start_time of the SLA as specified in the SLA Definition.

  • The schedule – Default choices are either to use the schedule specified in the SLA definition or to use the schedule from the CI associated to the task.

  • The time zone – There are five possible default selections for the tim zone, but this value must not be null for calculations. If the selection is null, the time zone is defaulted to the system timezone.

  • The duration – This can be fixed (User defined) or scripted (Relative duration). If there is a schedule, the duration is business time.

  • Any accumulated pause duration – This value is relevant only when transitioning from a Paused condition back to In Progress).

All of the values are fixed except the schedule, which is a reference value to a Schedule (cmn_schedule) and its Schedule Entries (cmn_schedule_span), and a Relative duration (which is scripted).

In simple terms, the planned_end_time is just the start_time with the actual duration added to it. The trick is in applying the adjustments for the schedule and the timezone in order to convert a business duration to an actual duration.

Common causes of errors

The most common causes of an error in the Planned end time are:

  • A relative duration script error
  • A schedule problem such as an incorrect schedule entry

Troubleshooting

If there is a question about the Planned end time calculated for any particular SLA, for troubleshooting:

  1. Check the Planned end time value by calculating it by hand.
  2. If the hand-calculated value does not check out and there is not a relative duration, check the schedule and the schedule entries.

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.