Creating a Workflow to Run When New Data is Added to a Database
Workflows are automated sequences of actions that connect different applications or services to streamline processes. A workflow typically starts with a trigger and then executes a series of actions in response to that trigger.
A workflow can be set up to trigger when new data is added to a specific database. In general, the system repeatedly monitors the database for new data entries. If new data entry is detected, the workflow is triggered, and a series of predefined actions are executed. These actions can include sending notifications, updating records, and more.
In this tutorial, we will create a simple workflow that automatically sends an email whenever new data is added to a database.
The process of creating a workflow to trigger when new data is added to a database is described in three main steps.
1. Creating the Database
As the initial step, we need to have a database created within the selected folder.
Let's manually create our database.
On the app homepage, go to the My Work tab on the left sidebar.
All the folders you have created, as well as those created by others, will be listed.
Click on the required folder to open it.
If you cannot locate the folder in the list, type in the folder name under Search Folders. From the search results, click on the desired folder to open it.
Go to the Databases tab.
Click + button and pick Create Manually option.
Enter a meaningful name for your database.
Click Continue.
Click Skip this step to manually enter database fields.
Add required database fields.
In the Field Name box, type in the name of the field, e.g., Complaint.
When you enter the field name, the system will automatically determine its type, such as 'Text'. Change the type if necessary.
To add more fields, click Add New Field.
After adding database fields, click Go to next Step.
Click Create New Database. An empty database will be created and listed under Databases tab of the respective folder.
Below is a image of the database we have created.
2. Creating the Workflow
Upon creating the database, we can start creating the workflow using the Workflow editor. Design your workflow by starting from a trigger block and connecting action blocks to it.
To create the workflow that sends an email when new data is added to the database:
On the Lucy app homepage, click the My Work tab on the left.
All the folders you have created, as well as those created by others, will be listed.
Click on the folder to open it.
If you cannot locate the folder in the list, type in the folder name under Search Folders. From the search results, click on the folder.
Inside the folder, click the Workflows tab.
Click the + icon. Workflow editor page will open.
Select the database trigger from the trigger list to start the workflow.
Click the How do you want to trigger your workflow? box.
Click When someone submitted data to <<Your Database Name>> Database trigger.
Note: Upon creating the database, it will be populated in the Database trigger list. However, if you haven't created the database, it won't appear in the trigger list. If the respective folder contains multiple databases (e.g., two databases), there will be two database triggers listed under the trigger list.
The selected trigger will display on the workflow editor page.
Select the block that defines the action to execute when the workflow is triggered.
Click the + icon of the selected trigger.
Filter and select blocks by category (e.g., Communications ) or type in the block name in the search box.
Pick the required block, e.g., Send Email.
Configure the properties of the Send Email block.
Enter the Subject of the email. Use Pills to customise the subject as necessary. These pills are used in input fields and originate from previous blocks in your workflow.
In the To box, type in the recipient’s email address.
In the Body box, type the message to be sent. Use Pills and format the message as necessary.
To add pills, click on the Body box. A list of pills will appear in a pop-up window.
Select required pills from the pop-up to be added in the Body section of the email.
Enter a suitable name for the Workflow.
Click Save.
You can find all your saved workflows under the Workflows tab within the respective folder.
3. Testing/Executing the Workflow
The last step is to test the workflow by adding a data record to the database.
On the Lucy app homepage, click the My Work tab on the left.
All the folders you have created, as well as those created by others, will be listed.
Click on the folder to open it.
Within the folder, navigate to the Workflows tab.
Locate and click on your workflow to open it on the Workflow editor page.
Complete the form and click Execute. This will execute the workflow and insert the data to the database.
Open your database to preview the changes. When a new record is added to the database, our workflow will send an email to the recipient.
You can add data records through the database as well. (Navigate to the Databases tab in the folder and select the required database to open it.)
Watch the video below on creating a workflow to run when new data is added to a database from the ground up to gain a better understanding.
Last updated