How do I create a Scheduled Action for a Notification?

Modified on Tue, 27 Feb 2024 at 11:50 AM

Within the Workflow area, you can add scheduled actions to send reminder notifications. You specify a workflow step, and when an action should execute. When the submission enters a workflow step, an action is scheduled for a time you specify and executes later.


How Do You Use It

Currently, this is only accessible via the code editor. You will work in both the Workflow area and the Notifications area. Follow the steps below and use the templates and examples to create your scheduled actions.


Part 1: Add the Scheduled Actions array to the desired Workflow Step

1. Add a "scheduledActions" array to the "onEnter" object. 

2. Add an object to that array for every action you want to schedule. If you want multiple reminders, add multiple "type": "remind" objects.

3. Add a "when" object that houses the "interval" (a number) and the "unit" (in minutes, hours, or days)

4. Add the "notificationTemplateId" that points to the notification. The value can be any string but needs to match the "id" of the notification object.


Please Note
The minimum scheduled action interval is 5 minutes. Any intervals below that will default to be sent at 5 minutes.


Part 2: Update the Notifications Object

5. Within the Notifications area, add the "id" to the notification object for which you want to add a reminder. Be sure to use the same value used with the "notificationTemplateId".

6. Add the "type": "remind" to the notification object. 

Code Examples/Templates

Scheduled Actions Object Template

{
"type": "remind",
"when": {
"interval": number,
"unit": "minute" | "hour" | "day"
},
"notificationTemplateId": string // an ID pointing to a template in the notifications object
}


Scheduled Actions within a Workflow Step Example

{
"steps": {
"start": {
"onSubmit": {
"target": "assign"
}
},
"assign": {
"onEnter": {
"assign": "getSubmittedBy()"
"scheduledActions": [
{"type": "remind", "when": {"interval": 3, "unit": "day"}, "notificationTemplateId": "12345"},
],
}
}
}
}


Notification Object Template

{
"assign": {
"onEnter": [
{
"id": "12345", // referenced by the templateId field in the remind scheduled action
"type": "remind",
"template": {
"subject": "Some subject",
"body": "Some email body"
}
}
]
}
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article