Call a classic action via the HTTP step to fall back to any functionality that is missing in the current-generation actions.
At the end of this article, you will know how to:
-
Call a classic action via current-gen actions
-
Send a value from form components to this action and use it within the classic action
Reminder: this is only achievable if you have a classic-gen Betty Blocks application.
To get started, add a default form component to the canvas and follow the wizard. In this example, a task model was selected with a title text property so that a text input component is added. This will also create a current-gen action without any action steps inside.
Now navigate to custom endpoints located in the bottom left of the builder bar. Here you can create custom endpoints. In this example, the custom endpoint is of the type GET
.
Add an input variable on the page and make sure that this matches the name and kind of the created action input variable based on the added form component in the page builder. In this example that is the title.
Next, create a new action on this custom endpoint. In this example, a create action event has been added but of course, this can be any other action event that is being offered. Map the input variable of the custom endpoint to the assigned property as you normally would. This action is now ready to be called by a current-gen action.
Navigate back to the page and form component made in the first step of this tutorial and open the current-gen action that was created by the form component. Here you can add an HTTP(S) step to the action and fill in the URL
to the custom endpoint that was created in the first step of this tutorial. Make sure the PROTOCOL
and METHOD
also match the custom endpoint.
Now you can define the QUERY PARAMETERS
on the current-gen action. Make sure the KEY
matches the INPUT VARIABLE
defined in the custom endpoint so that the values are passed successfully. The ACTION INPUT VARIABLE
passes the value of the input component that was added in the form.
You can navigate to the page and compile it to access the form in the runtime environment. Before you do this, make sure the permissions of the action have been set. Here you can fill in the title of the task as you would normally do and the record will be created via the B5 action that is called by the current-gen action.