How to create a Trigger
Step-by-Step Guide
Step 1: Access the Data Objects Section
Navigate to the Data Object section in your Orchestrator toolbar.
Step 2: Create a New Trigger Data Object
There are two different ways to create a Trigger, one is by directly clicking the Trigger button on the Data object screen, the other one is selecting ACTIONS button on the table that we want to add the trigger. This last way will be further explain the How to use Data Object Actionsdocumentation.
Step 3: Fill Out the "Add Trigger" Form
After clicking the button, you'll see the following screen. Fill out the form to create your trigger. Choose the table that you want the trigger to work with, enter a trigger name, and select a Trigger type.
In this table is the explanation of each trigger type:
Type | Purpose |
---|---|
Replication | Record changes made in a database. Triggers can be configured for INSERT, UPDATE, and DELETE statements, specific columns, or rows. |
Notification | Send specific notifications to users and trigger workflows based on data changes. For example, notify the sales team when a new product is added. |
WebHook | Send data from a table in a JSON payload to external web hooks via HTTP POST requests. For example, send order data to an e-commerce platform when a new order is placed. |
Audit Log | Record all changes made to a table, such as INSERT, DELETE, and UPDATE statements. Useful for auditing changes or troubleshooting issues. |
Manual Trigger | Create custom triggers for specific table actions. Write custom SQL code to execute when the trigger is activated. |
Prepared tables created by Triggers
Using the prepared tables created by the Replication, Notification and WebHook triggers require a Data Workshop Object, to enable processes that utilize them their specific purposes.
Step 4: Fill the Specific Trigger form
Replication Trigger
A prepared table called dk_replica will be created to store the information of the replication events.
- Type of action to fire trigger: This identify the type of action that will fire the trigger, this action can be:
INSERT:: If information is inserted inside the table, the trigger will fire.
UPDATE:If information is updated inside the table, the trigger will fire.
DELETE:If information is deleted inside the table, the trigger will fire.
- Channel: The channel name will be identifying the replication events created by this trigger, this is normally use in the Data Workshop.
- Condition to save events: You can create conditions using filter to further customize the action that fire the triggers, this can be: normal filters, multiple values, field to fields filter that compares the values between to fields and customize SQL filters.
No Conditions
If you don't add any filters, all events that follow the type of action to fire the trigger will be save in the "replica" table of the trigger.
- Columns to save value state when events are saved: This allows you to specify which columns values you want to save when the replication event is trigged. If its empty, it will not save state data.
Notification Trigger
A prepared table called dk_notify will be created to store the information of the notification events.
- Type of action to fire trigger: This identify the type of action that will fire the trigger, this action can be:
INSERT:: If information is inserted inside the table, the trigger will fire.
UPDATE:If information is updated inside the table, the trigger will fire.
DELETE:If information is deleted inside the table, the trigger will fire.
- Channel: The channel name will be identifying the notification events created by this trigger, this is normally use in the Data Workshop.
- Condition to save events: You can create conditions using filter to further customize the action that fire the triggers, this can be: normal filters, multiple values, field to fields filter that compares the values between to fields and customize SQL filters.
No Conditions
If you don't add any filters, all events that follow the type of action to fire the trigger will be save in the "notify" table of the trigger.
- Columns to save value state when events are saved: This allows you to specify which columns values you want to save when the notification event is trigged. If you don't specify any columns it will not sent any information.
WebHook Trigger
A prepared table called dk_webhook_events will be created to store the information of the WebHook events.
- Web-Hook Url: In this field write the Web-Hook Http POST Request.
- Type of action to fire trigger: This identify the type of action that will fire the trigger, this action can be:
INSERT:: If information is inserted inside the table, the trigger will fire.
UPDATE:If information is updated inside the table, the trigger will fire.
DELETE:If information is deleted inside the table, the trigger will fire.
- Condition to save events: You can create conditions using filters to customize actions that trigger events. These can include normal filters, multiple values, field-to-field filters that compare values between two fields, and customized SQL filters.
No Conditions
If you don't add any filters, all events that follow the type of action to fire the trigger will be save in the "webhook_events" table of the trigger.
- Columns to include in the JSON payload: This option allows you to specify which column values you want to save and send to the Web-Hook via a JSON payload. If no columns are selected, all data in the table will be sent.
Audit Log
A prepared table called *_dk_audit__tablename* will be created to store the information of the WebHook events.
- Type of action to fire trigger: This identify the type of action that will fire the trigger, this action can be:
INSERT:: If information is inserted inside the table, the trigger will fire.
UPDATE:If information is updated inside the table, the trigger will fire.
DELETE:If information is deleted inside the table, the trigger will fire.
- Columns to save value state when events are saved: This is the final field in the form. Here, you can specify which column values you want to save when saving the audit log event. Leaving it empty will exclude state data from being saved.
Manual Trigger
This trigger will not created any prepared tables.
- Type of action to fire trigger: This identify the type of action that will fire the trigger, this action can be:
INSERT:: If information is inserted inside the table, the trigger will fire.
UPDATE:If information is updated inside the table, the trigger will fire.
DELETE:If information is deleted inside the table, the trigger will fire.
- Time to fire trigger:
Before each row:Execute the action of the trigger before inserting each row on the table.
After each row:Execute the action of the trigger after inserting the rows on the table.
Step 5: Check your created trigger
After selecting the type and filling out the required information, you can check your trigger in the selected table. By clicking the lightning icon, a dropdown list of every trigger linked to the table will appear..
Updated 5 months ago