Note: this feature might change slightly and might not yet be enabled in your application
After reading this article you will know:
First steps for creating an action in your application
What action flow is and how to build it
How to use action steps
Some tips to take in mind while building
Actions are made to provide logic in an application. This logic is executed after a certain event called a trigger. For example, a user can trigger a certain order of events by clicking a button.
You can create your own workflow in action builder by adding action steps. Action steps will serve as a logical construction as the events will be executed on conditions that you set yourself.
Creating new action
There are two basic ways of creating a new action in the Betty Blocks platform: you can create it from scratch or use the page builder components as a starting point. To begin with, we will describe the first way: creating action from scratch.
Find the “Actions” section on the builder bar: Then click on the |
Fill in the action name and its description in the pop-up window. It is strongly recommended to stick to the action’s goal while naming it. |
Enable the |
Building action flow
Now you are able to see your action workspace. Any action is created by connecting individual action steps together like a flowchart. By default, every action consists of two pre-defined steps: ‘Start’ and ‘Finish’. A series of events can appear between those pre-defined steps. The order in which steps are applied provides the logical process in a workflow. Each step has its own purpose with some affecting the action flow.
The ‘Start’ step is used to configure input and/or action variables, while in the ‘Finish’ step you can configure the name of a variable containing the result of the whole action. More about variables here.
Action steps
On the sidebar, you can see a set of steps one can use within the action builder. Betty Blocks provides a standard set of frequently used steps out of the box: Authenticate User, Update Record, Delete Record, Create Record, Log Message, and Loop. This set of steps will be extended over time. |
Each step is able to perform its own function - a piece of logic that can be configured individually. For instance, the ‘Create Record’ step creates and inserts records into the database. For more information on each individual step, read the Action step functionality article. |
Action is created in a very simple way by just dragging action steps from the sidebar into the action flow. You can construct a rather complex logic of your action flow using individual components. When dragging steps, positions, where this step can be placed, are highlighted with small circles. |
Once an action step is dropped in the desired spot, the whole action flow is reconstructed. By clicking on the step in the action flow, you can configure the logic of the step. For example, in the ‘Create record’ step you can select a model to work with, set its value mapping, and add variables available inside the current step. After you configured the step, save it using the button at the bottom. |
Any step can be removed from your action flow by means of the |
Creating new action via page builder
Up to this point, we went through the basics for building an action flow from scratch. However, the common way that you might use when you start working with the platform is assembling the actions by using some of the components in the page builder. So, here’s an example of how to do this.
Note: As the new actions segment is still under development, at the moment you are only able to work with form components in the new environment.
First, open the pages on the builder bar (1), then go to components (2) and pick up ‘Create form’ (3). This component will serve us as an example here and later in this article. Mind that it’s also possible to get to actions using other components of the page builder. |
Drag the ‘Create form’ component onto the page canvas. In the pop-up window, you will have to configure form fields: select a model from existing data models (1), choose properties by clicking on the ‘+’ beside them (2), and click on ‘Save’ (3). |
The ‘Create record’ form has been created on your page. Now choose any field within this form and click on |
When the parent component ‘Form’ is chosen, its options menu will open. There you need to click on |
After clicking the |
Let’s have a look at how it will interact with the front-end side of the application. Come back to the page builder, choose the page with the ‘Create record’ form and click on the play button. This is what the form will look like from a user’s perspective. |
After filling in this form, a user will click on ‘Send’ - it will serve as a trigger for the action to be launched. At the end of this action flow, we get a new record with a user’s name and email in our database. |
Tips
Make sure to always test run your action in every sandbox environment. A sandbox might have different configurations and data and might cause a different end result than anticipated.
Action duration has a maximum of 1 minute, if your action takes more than a minutes we recommend splitting the action into batches or using less data.
The default maximum amount of records for an action collection is 200, we recommend to split your action collection into batches when you work with more than 100 records at a time
➝ Next article: Action step functionality