Update record

Learn how to use the update record operation on your table by using a gym bot example.

Updating a record from your table means that an already-existing record is updated on one of several of its cells.

To exemplify this, we will use a gym booking bot that uses a Table to store who is booked in a yoga class. By updating record, we will add the user as enrolled to the class.

This means that you'll go from this:

classNameclassTeacherisBooked

Zumba

Monday

None

To this:

classNameclassTeacherisBooked

Zumba

Monday

Agatha

Update a record

  1. Make sure that you have a well-defined table. For this example, we'll use gym booking table with those fields:

    • ClassName: Name of the fitness class.

    • ClassDay: Date of the class, in a consistent format (e.g., YYYY-MM-DD).

    • ClassTime: Start time of the class, using a clear format (e.g., HH:MM AM/PM).

    • ClassTeacher: Name of the instructor leading the class.

    • IsBooked: Status field indicating whether the class is booked ('None' or 'Available' by default, updated to customer's name upon booking).

A table that stores gym class bookings.
  1. In your bot flow, identify the point in the conversation where the customer chose a class and confirmed their booking.

  2. Add a Table operation to your flow.

  3. Choose Update record from the list of operations.

  4. Select the table that you want to update. For this example, we'll select Gym class booking.

Select the table that you'd like to update.
  1. Under Operation Config, under the isBooked column, add the variable holding the customer's name. In our example, this variable is called {userName}. This means that the isBooked column will be updated with {userName} as a new value.

Update the isBooked column with the {userName} value.
  1. Under Define a selection criteria for the records to update, click on + Add filter to set the conditions to identify which record (or row on your table) should be updated. In our example, the conditions should match the class that the customer is booking. Therefore, we're going to check that {className}, {classDay}, {classTeacher}, and {classTime} are already specified.

Define selection criteria to define which record (or row on your table) should be updated.
  1. Click Save.

Your Action block with the Table operation appears on your canvas.

  1. It's crucial to check the functionality of your Update record operation to ensure data is captured and stored correctly. Utilize the emulator to test the flow that you just build.

Test your Update record flow.
  1. After completing the booking process in the test, navigate to the updated table (in this example, it's called Gym class booking) to verify the update. Ensure the isBooked field is filled with the customers booking the selected class are updated as expected.

The Update record operation works on the table as expected.

Looking for a quick and easy bot template to play with Tables? The Gym bot is a representative use case.

Last updated