Using Time Rules

Last Updated -

You may want to use a Time Rule for cleanup tasks, sending email reminders, closing cases that have not had activity in a while, etc.   Time Rules are executed against cases that have been sitting New for an hour without being handled. There are countless other ways to use time rules, but in order to create a time rule, you must first understand how they work.

What is a time rule?
Time Rules are special rules that are not "event triggered", but instead are executed in intervals, every 15 minutes, checking the  conditions of the case in order to determine whether or not to run on that case.  If all of the conditions are met, then the rule is run on the case. If all of the conditions are not met, then the case will be skipped.

Unlike other business rules, time rules do not require any interaction to occur in order to fire on a case.

Specify the case status in your Time Rule.
You should always have a rule condition that specifies which case status the cases that you are intending to update will be. The reason is that closed cases cannot be modified, so if your rule attempts to run on a closed case, you will receive an alert in your system logs (and email if you have configured your system logs to send an email) stating that you attempted to update a closed case.

You should add the condition as shown in this example to any time rules that do not explicitly check for the status of the case:


What is an infinite loop?
It is also important to note that a time rule cannot run on the same case more than 3 intervals in a row. This will create a scenario called an infinite loop, and and you will receive an alert stating that your rule was stuck in an infinite loop and has been disabled.

Why does disable the rule when it runs in an infinite loop?
Time rules stuck in the infinite loop scenario are disabled to prevent repeated actions, such as sending hundreds of automated emails from occurring.

Lets say your business is open from Monday - Friday, 9AM-5PM. And lets also say that you have a time rule that sends a notification to your agents if a case is New and unhandled for more than 1 hour. On Friday night, the case meets the conditions of the rule. Without the infinite loop prevention of disabling the rule, the agent would get emailed every 15 minutes until the rule was disabled,  and possibly not being noticed until Monday morning.

How do I prevent my rule from running into an infinite loop?
The easiest way to prevent an infinite loop is to use labels. Create a label for every time rule that you create. Add that label in your rule actions, and then check for that label in your rule conditions so that the case will be ignored at the next 15 minute interval, and all subsequent intervals. This type of configuration will ensure that the rule only runs on your cases one time, avoiding the rule from ever being able to get stuck in an infinite loop.

Here is an example of a misconfigured rule that would eventually be disabled due to running into an infinite loop:


Here is is an example of the same rule, modified using a label to prevent it from ever running into an infinite loop.



In the first rule, you can see that the Notification would have been sent every 15 minutes (infinitely, if not for disabling the rule after 3 consecutive runs) because the conditions are the same at every interval. In the second rule, we add the label in the rule action, and check for it in the rule condition.

At the first interval after the case was new for greater than 1 hour, the label does not exist so the rule actions are performed- one of which is adding the label. 

At the second interval 15 minutes later, the case was still new for greater than 1 hour, but the label now exists from the previous interval,  so the rule actions are not performed.

This same behavior will occur on all subsequent intervals, as long as the label exists on the case. If for some reason, you wish to have the rule run on this case again in the future, you can either remove the label, either manually by the agent or automated via another rule.

Using "Hours Since" conditions.
As shown in the screen shots, you may want your rule to run after a certain number of hours has passed. We suggest using Hours Since Greater Than Or Equal To ..." rather than using "Hours Since Is..." . The reason is simple. There may be some instances where the backend jobs are backlogged, disabled, or dont run at the interval specified for some other reason. When using the "Is" operator, once the interval has passed, it has passed forever and the rule may never run on cases that it would have met during the jobs issue. However, using "Greater Than or Equal To" will allow the rule to pick up where it left off and find the cases that would have been missed using the "Is" operator. As a best practice, we recommend using "Greater Than or Equal To"  instead of "Is".

With, you can set Business Rules to run in relation to your organization’s Business Hours settings. This allows you to send after-hours acknowledgements, escalate key customer requests after hours, as well as reassign cases after hours.

You can set any new or existing Run Rules to run 24 hours a day. The Run Rule dropdown gives you a choice of “Anytime,” “During Business Hours,” or “Not During Business Hours.”.

The steps outlined above should be the framework for creating any time rule.

Below are some example use cases for time rules:
Closing cases after they are Resolved for two weeks