Skip to main content
Create record step

The use and options of the Create record step in Actions.

Updated over 5 months ago

After reading this article, you’ll know the following:

  • What the Create record step is and its purpose

  • How to use this step in your application

What is the Create record step?

Create record is a CRUD action step designed to add new records to a database. This step allows users to define and assign values to the properties of these records, using either static values or dynamic variables. By leveraging this functionality, users can efficiently manage and manipulate data within their applications.

Create record icon

In managing employee onboarding, when a new hire fills out their onboarding form with details like name, position, start date, and contact information, the Create record step in Betty Blocks can automatically create a new record in the Employee model.

Create record step options

This ensures accurate recording and storage of new employee information, allowing HR to access details easily and initiate further onboarding tasks like provisioning equipment or scheduling orientation sessions.

Options

Model: Select the model where the new record will be created.

Selecting Employee model in the Create record step options

Value mapping feature enables you to map new values to the properties of the selected record. These values can be either static, where you manually input the values, or dynamic, where you use variables. The new values provided will overwrite the existing values in the record.

As: Define the variable name for the new record. This variable can be reused in subsequent steps within the same action.

Saving a result variable

Variables: In this separate tab, you can add more variables to the step, which can be used for dynamic value mapping. This is particularly useful when the values that need to be assigned depend on other variables or calculations within your application.

Variables within Create record step

Use case - Create form component

One of the easiest and most intuitive ways to use the Create record step in Betty Blocks is through the Create form component in Pages. Applying this component, users can quickly set up a form that captures and stores data in a specified model with minimal configuration.

To get started, simply drop the Create form component onto the Pages canvas. You will then be prompted to configure the form:

  1. Select model: Choose the model where you want the data to be stored. For instance, if you are managing employee onboarding, you would select the "Employee" model.

  2. Select properties: Specify the properties you want to include in the form. These could be fields like Name, Email, Start date, Active, etc.

Configuring the Create form component

The Create form not only generates the form fields but also automatically creates a new action with pre-configured values and the Create records step.

After setting up the Create form, navigate to the form's options and locate the action attached to it. Use the pencil icon to edit this action.

Action in the Create form options

You'll notice that:

  • Start step, which passes the variables from the form to the "Create records" step, is already set up.

  • The fields in the Create record options are pre-filled with the form's values.

  • In the Finish step, there’s the result value picked up from the Create record step

Automatically created action via the Create form

Use case - Condition flow result

Another use case for the Create record step is within a flow that includes a Condition step. For instance, in managing email configurations, you can use the Condition step to check if an email configuration record exists in the database.

If it exists, drop the Update records step to the True flow to update the existing record with new values, which you fill in yourself in the Value mapping section (e.g., Port, Username, Password, Hostname). If it doesn't exist (Else flow), the Create record step creates a new email configuration record. This ensures that email configurations are either updated or newly created as needed.

Create/update email configuration

In most cases, the Create record step is implemented via the Create form component on the front end, allowing users to fill out forms and have their data saved automatically. However, this step can also be used within other action flows, offering flexibility to manage data efficiently in various scenarios.

Did this answer your question?