Databases by Quickwork app

This section explains how to efficiently perform CRUD operations on your collections (or tables) using the Databases by Quickwork app.

Using the Databases by Quickwork app enables automated CRUD operations within journeys, ideal for situations where database interactions must be part of automated sequences, such as updating records based on trigger events or querying data as part of conditional logic within a journey.

Prerequisites

Setting up CRUD operations using the Databases by Quickwork app

Using the Databases by Quickwork app, you can manage your database collections by selecting actions such as add record, lookup record, update record, search record, delete record, and truncate table.

Set up a journey using a suitable trigger. For this demonstration, let's use the HTTP trigger with the GET method.

Add record

The Add record action allows you to add a new record to an existing collection.

  1. Choose Databases by Quickwork as the action app.
  2. Select Add record as the action from the available options. The connection to the app is automatically established.
  3. Select the appropriate Collection ID from the drop-down. For example, Sample Collection.
  1. Enter the necessary data, such as name, email, and phone number into the input fields provided. You may also drag and drop the data pills from the previous step.
  1. After configuring the action, click Save & Start button to start the journey.

  2. Open the Journey tab and click on the URL to initiate the trigger.

  3. Go to the History tab to verify that the new record has been successfully added.

  4. Navigate to Tools, select Databases, and access the collection to view the added record.

Lookup record

The Lookup record action is designed to search for an existing row within a collection based on any field value. It functions similarly to a search action, retrieving only a single entry. The action returns the first entry that matches the provided search criteria. If the collection contains duplicate entries for the search criteria, only the first found entry is returned.

  1. In the Sample Collection, configure the Lookup record action to search using the Name field.
  2. Enter the field that you wish to search for in the collection. For example, name in the Name input field.
  1. Execute the action and review the response in the History tab. The Output will display only one entry, even if multiple entries with the same name exist. Column fields of the returned entry are also displayed, providing detailed information about the record.
📘
  • The field must be an exact match, not a partial match. Searching for George will return recordFound as false if the exact match is not found.
  • The Lookup record action can be crucial as it retrieves specific records necessary for subsequent processing for actions that follow in the journey, for example, the Update record action.

Search record

The Search record action searches and retrieves all entries matching specified criteria, unlike the Lookup record action, which returns only one entry. It returns all matching records from the collection, providing a comprehensive view of relevant entries. Similar to the Lookup record action, it shows column fields for each returned entry, offering detailed insight into each record.

Update record

The Update record action updates an existing record present in the collection. This action requires a Record ID of a collection, for mapping and performing the update operation.

  1. Use the Lookup record or Search record action to locate the record you need to update, such as finding George Michael's details.
  1. Choose the Update record action from the Databases by Quickwork app.
  2. Retrieve the Record -> id data pill from the Data Tree Output generated in the Lookup record or Search record step and drag it into the Record ID input field to specify which record to update.
  3. Drag the relevant data pills (Name, Email) into their respective fields and manually enter the new Address, if required.
  1. Execute the journey to update the record.
  2. The modifications will appear in the Transaction Report within the History tab.
  1. Sample Collection under Tools - Databases, displays the updated details.

Delete record

  1. Use either the Lookup record or Search record action to find the specific record and obtain the Record ID necessary for deletion.
  2. Select the Delete record action from the Databases by Quickwork app.
  3. Drag the Record -> id data pill from the output of the Lookup record or Search record action into the Record ID input field in the delete record action setup.
  1. Run the journey. Upon successful execution, the Transaction Report will confirm the deletion with a success message.
  1. Check the Sample Collection to confirm that the record is removed.

Truncate table

The Truncate table action removes all records from a specified collection simultaneously rather than deleting them individually.

  1. Choose the Truncate table action within the Databases by Quickwork app to prepare for bulk deletion.
  2. Specify the collection you wish to clear by selecting the appropriate Collection ID.
  1. Run the journey to perform the truncation. This action will remove all entries from the specified collection.
  2. Upon successful completion, the Transaction Report will display a success message confirming that all records have been deleted.
  1. Check the Sample Collection to observe that it now contains only the column headers, with all record data removed.
📘

The Truncate table action is irreversible. Hence, ensure that truncating the table is the intended operation, as the deleted records cannot be retrieved.

Sample use case: Calendar event tracker

In this use case, a journey is triggered whenever a new event is created in Google Calendar. The journey then adds a record of this event to a Quickwork database. This setup automates logging calendar events, providing an organized and easily accessible record of all entries directly within Quickwork.

Now let us create the journey:

  1. Set up the database:

    1. Log into Quickwork, navigate to the Tools menu, and select Databases.

    2. Click on + Create a new collection button. Name it Calendar Event Logs. Add columns for Created by, Participant Name, Description, and Created date.

  2. Configure the journey:

    1. Select Google Calendar app and select New event as the trigger.

    2. Set up the Add record action using the Databases by Quickwork app to store event details such as the event name, time, and participants into the database.


    1. Click the Save & Start button to execute the journey.

Testing your journey

  1. Test the setup by creating a new event in your Google Calendar to trigger the journey.
  2. Refresh the History tab to view the event details.
  3. Check Tools - Databases. The event details are updated in the database.

By integrating Google Calendar with Quickwork’s database functionalities, organizations can enhance their event management processes, ensuring that all event details are captured systematically and stored securely for future reference.

Troubleshooting

  • Data mismatch: If the data doesn't appear as expected in your database collection after operations, double-check the data fields you send in your journey actions. Ensure that the field names in your actions match exactly with those in your database collection.
  • Action failures: If a specific database action fails (For example, Update record, Delete record), check the Record ID used in the action. Ensure that the Record ID is being correctly passed from the output of previous steps like Lookup record or Search record.
  • Unexpected results with Lookup record and Search record actions: If the Lookup record or Search record actions are not returning the expected results, verify the values you are searching for. Note that the Lookup record action requires an exact match. If searching for partial matches, results may vary.

📚 Additional resources

Introduction to Databases in Quickwork
Using the Databases tool
Introduction to HTTP