Reminder generators
Fields of the reminder generator, which sends a notification again and again until a stop condition is met, and the order reminders run in.
A reminder generator sends an outbound notification to chosen users on a schedule until the record meets a stop condition, for example to chase an approver. This page lists its fields and the order reminders run in, for administrators with the configuration_administrator role.
Reminder generators are under Administration → Configuration → Reminder generator. Several generators can run on one record, and each keeps one reminder per user.
Reminder generator fields
| Field | Type | Behaviour | Purpose |
|---|---|---|---|
| Name | Text | Required. | Identifies the generator, for example “Change approvals - Remind twice then reject”. |
| Active | Yes or no | Only active generators run. | |
| Table | Table | Required. | The table whose records the conditions are tested on, for example WorkflowTask. |
| Notification | Outbound notification | Use a notification on the same table, or references to current in it may not work. |
The notification each reminder sends. |
| Reminder limit | Number | Default 0. | How many times the notification is sent before the reminder stops. |
| Initial reminder delay | Duration | Optional. | How long to wait before the first reminder, for example 2d. |
| Duration between reminders | Duration | Required. Business time within Schedule. | The gap between reminders, for example 1d 16h. |
| Schedule | Schedule | Optional. Empty means reminders run at any hour. | The business hours and holidays the durations count in. |
| Timezone | Choice | Optional. Empty means the reminded user’s time zone. | The time zone the schedule is read in. |
| Users to be reminded | Script | Set answer to an array of user IDs. Receives current. |
Who gets a reminder. |
| Start condition | Condition | If Start condition script is also set, both must match. | When reminders start, for example while the status is open. |
| Start condition script | Script | Set answer to true or false. Receives current. |
Start conditions a query cannot express. |
| Stop condition | Condition | If Stop condition script is also set, both must match. | When reminders stop. |
| Stop condition script | Script | Set answer to true or false. Receives current. |
Stop conditions a query cannot express. |
| Script run on reminder limit | Script | Optional. Receives current. |
What happens after the last reminder, for example rejecting the approval. |
Durations are a number followed by a lowercase unit: d (24 hours), h, m and s. For example 4d 3m is four days and three minutes. A business duration of 28 hours is shown as 1d 4h.
When Users to be reminded is empty, reminders are still created for matching records but with no user. They go to every recipient the notification itself names, including Cc and Bcc.
How reminders run
- When a record is saved, Servicely reads every active reminder generator for its table.
- For each generator it tests the stop condition first. If it matches, every active reminder for the record from that generator becomes inactive. A record that meets both conditions is stopped, not started.
- If the stop condition does not match but the start condition does, Servicely works out who must be reminded.
- If that list changed, reminders stop for users no longer on it, start for new users, and restart with a fresh count for users whose reminder was inactive.
- When a reminder falls due, its count goes up by one.
- After the initial delay, Servicely tests the stop condition again. If it does not match, the notification is sent. Its subject starts with the value of the
platform.reminder.notification_subject.prefixproperty,Reminder:by default. - Each later reminder tests the stop condition on the record again before it is sent.
- If the reminder limit is not reached, the next reminder is scheduled. If it is reached, the reminder becomes inactive.
- When a reminder stops at its limit, Script run on reminder limit runs.
Tables without reminder triggers
Tables extended from Work, WorkflowTask and Interaction already run reminder generators. For any other table, add an After trigger on create and update with this script:
ReminderGenerator.processReminders(current);
Example: chase an approver twice, then reject
| Field | Value |
|---|---|
| Table | WorkflowTask |
| Notification | Workflow task - Approval request for change |
| Reminder limit | 2 |
| Initial reminder delay | 2d |
| Duration between reminders | 1d |
| Start condition | Status is open |
| Stop condition | Status is not open |
Users to be reminded:
// The approver of the workflow task
answer = [current.Assignee().getID()];
Script run on reminder limit:
// Reject the approval
Workflow.reject(current.getID());