Triggers

Listen for Skedulo events by using triggers.

There are two types of triggers that can be defined:

  • object_modified: Executes when a tenant data record is inserted, updated or deleted.
  • event: Executed when a predefined event occurs. The following event types are supported:
    • async_task_completed: An asynchronous task executed by the platform has completed. Supported async tasks are:

      • bulk_user_import
      • copy_schedule
      • apply_schedule_template
    • recurring_schedule: This event can be triggered with an API call to /recurring/schedules/jobs/event to indicate that a Recurring Schedule update has finished.

Object modified triggers

An object modified trigger requires the following information:

  • A filter that specifies when the action should be performed.
  • The target schema/object name.
  • Optionally, a deferred specification.

The filter is a special version of the EQL format that is relevant to change events. It may refer to the Operation that caused the change (INSERT, UPDATE OR DELETE) and must refer to fields of the object via the Current or Previous parent object. For example, Operation == 'INSERT' AND Current.JobStatus != Previous.JobStatus.

For more information about using EQL filters, see the EQL filter section.

See also ‘Change event tracking for custom objects’ below.

Deferred triggers

The deferred specification for a trigger describes when in the future the action should be performed. This specification resolves to an instant in time that is calculated relative to the value of a specified DateTime field of the object (the “anchor” time).

The offset is specified as either a static value in milliseconds or a dynamic value that is provided by a field of the object.

If the value of the anchor time field or the offset field changes, the action will be rescheduled to the new time.

Example 1: Perform the action 5 minutes before the Start time of the job:

    "deferred": {
        "fieldName": "Start",
        "offset": -300000
    }

Example 2: Perform the action at some offset after the Start time of the job, as specified by the NotificationAfterStartOffset custom field, defaulting to 10 minutes:

    "deferred": {
        "fieldName": "Start",
        "offset": {
          "fieldName": "NotificationAfterStartOffset",
          "default": 600000
        }
    }

Change event tracking for custom objects

In order for a data object to trigger a triggered action, it has to be tracked for changes. Tracking is automatically enabled on standard data model objects, and on all custom objects created after 10 May 2024. Custom objects created prior to this date need to have tracking manually enabled. Additionally, Skedulo for Salesforce teams require additional configuration within Salesforce in order to enable change event tracking for all objects.

To manually enable tracking on a custom object, follow these steps:

  1. Find the id of the custom object (schema) using the /custom/schemas endpoint in the Skedulo API
  2. Pass the id to this endpoint: /custom/standalone/schema/{id}/track