A Daily Schedule Business Rule allows you to run Actions on a specified schedule. In this tutorial, we will go over how to build a Daily Schedule to send users an email on the first day of each new quarter. First, a general pointer on configuring Daily Schedules:
- While tempting, assigning a Condition to a Daily Schedule is never a good idea. Instead, use Liquid to construct a Raw Transaction Filter that either does or does not return Records. Conditions are much less efficient than Raw Transaction Filters because they check the filter using the context of each Record individually; while Raw Transaction Filters apply to the entire App environment at once.
Before We Start...
Check out these relevant tutorials:
Let's Get Started
First, we need to build our filter. Navigate to the Filters node in the App Designer and create a new Raw Transaction Filter. Name it 'First Day of New Quarter' and enter the following filter.
{% assign var1 = now | date: ‘%m/%d’ %}{% if var1 == ‘01/01’ or var1 == ‘04/01’ or var1 == ‘07/01’ or var1 == ‘10/01’ %}[{ “property”: “curr_state_name”, “operator”: “like”, “value”: “Open”, “type”: “string” }]{% else %}[{ “property”: “curr_state_name”, “operator”: “like”, “value”: “/DONOTSEND”, “type”: “string” }]{% endif %}
Let's break this filter down. First, var1 represents the current date in a month/day format. Next, we use Liquid to check if the current date is one of the four first days of a new quarter (in purple).
If it is the first day of a new quarter, the filter will return a value in green, which returns all open Records in our App. If it is not the first day of a new quarter, the filter returns a value in red, which evaluates to nothing.
Next, let's build the email that will go out. Navigate to the Actions node and create a new Send Notification Action.
Fill in the Action's name, the Subject, the Recipient Emails, and the Body.
Now, we will put it all together. Navigate to the Business Rules node and create a new Daily Schedule. Under Filter, choose Raw Transaction Filter, the First Day of the New Quarter. Finally, under Actions, select the Send Notification "First Quarter Email" Action.
Click Create to create your Daily Schedule.
This Daily Schedule will fire the Send Notification Action once per Record returned by the Raw Transaction Filter.
Pause / Resume, Retry / Cancel Daily Schedules
Admins can pause, resume, retry, and cancel Daily Schedules from the Batch Processes node in the /admin panel.
First, navigate to the /admin page and click on the Batch Processes node. Here, you will see a list of completed or pending batch processes. Click on the appropriate process.
The pause, resume, and cancel options are only available when a Daily Schedule is running. Once the Schedule is complete, the "Cancel Batch Process" and "Resume Pending Work" buttons will be grayed out, as seen below.
Once a batch process is complete, and if any errors are encountered, you can retry the rows with errors using the Retry Rows with Errors button.