Warning!
This is a legacy document. The features described below are only usable within the classic-generation environment.
Currently, Betty Blocks offers faster and more advanced options that are available in next-gen. Before you start working on some new features in your application, consider doing it using the next-gen version. Good luck!
Actions are visual workflows that require a sequence of steps to execute. These steps are determining the action's roadmap. The road of steps an action has. Example steps are Condition (true or false), Create, Update, Import, Http request, etc.
Visual Action Editor
When the action is created and saved, the Visual Action Editor appears. This shows the road of steps an action travels. If you click the plus, you can add a new step to your action. The action step screen opens, showing the Kind setting at the top. This setting defines what kind of action step you're creating. As seen in the image below, there are quite some options available, ordered by category.
All action steps
Below we have described all action steps you can design your actions with. The following attributes are default for every single step:
Success message: Set a message to be shown when the step is successfully executed. This message is parsed in the logs when debugging is enabled.
Error message: Set a message to be shown when the step is unsuccessfully executed. This message is parsed in the logs when debugging is enabled.
Help text: Set a message for further explanation about the step. Does not impact the execution of the step.
Log message: Set a message for debugging purposes. By including variables and expressions, set a message to parse the steps' results. Only parsed in the logs when Debug action and steps turned on.
Flow control
Action
With this step, you can select a previously created action or create a new one to execute as part of the action you're currently viewing.
Kind: Action
Action: Select an existing action or create a new one to be executed as part of the action you're currently viewing.
Execute this action in foreground: This setting determines whether the action will be executed directly before continuing with the other steps or if it's scheduled for background processing.
Assign: Pass values on to the Action. All Input variables from the chosen Action will be available for assignment.
Condition
With this step, you can set an expression or filter to be evaluated and return a true or false value. This is used as an IF then ELSE in the action flow.
Kind: Condition
Condition: Two options available: Use filter and Use expression. The first option is considered easier, almost "fool-proof" as it only shows the available options. Select one of the available object or collection variables and define one or multiple condition rows to be evaluated, based on the properties available on the corresponding model. By clicking the blue "chain-link" button, you can select variables for condition values.The second option, Use expression, is a bit more technical, but offers more freedom. By inserting variables and configuring expressions you can build the most complex conditions the evaluate.
True message: Set a message to be shown when the condition is evaluated as True.
True message type: Choose what kind of message to be shown when the condition is evaluated as True: Error or Success.
False message: Set a message to be shown when the condition is evaluated as False.
False message type: Choose what kind of message to be shown when the condition is evaluated as False: Error or Success.
Group
With this step you can split collections on a unique value and use the results for further processing. For example; you have a collection of Activities, each related to an Employee. You want to send each Employee one email. By selecting the Activities collection in the group step and grouping by Employee, you'll get multiple Activities collections, one for each Employee. Keep in mind to set the Key option, as it makes the value which is grouped on available, in this case Employee.
Kind: Group
Collection: Select a collection which needs to be divided and grouped on a certain value.
Group by: Select a property or relation from the collection model you are grouping on.
Collection as: Choose a name for the variable under which the grouped collection will be available.
Key as: Choose a name for the variable under which the unique value which is grouped on will be available.
Accept nil values: Some records may not contain a value in the property which is used for grouping. With this setting enabled, all records without the grouping value are collected in a separate collection. With this setting disabled, the action will fail when a nil value is met.
Loop
With this step, you can select a collection and loop through each object. Each iteration handles an object from the collection. The As variable from the loop step makes the current object available. That means in every iteration, this variable contains a different value/object.
Kind: Loop
Times: Select a (number) variable to set the number of iterations this Loop step takes.
Through: Select a collection to loop through in this step. Each iteration handles a record from the collection.
As: Choose a name for the variable under which the object of each iteration will be available.
Index: Choose a name for the variable under which the current iteration will be available. For example, in the 48th iteration, this variable holds the value 48.
CRUD
Assign
With this step, you can assign values to an existing object's properties and relations without executing a save operation. Use this step in combination with the Before callbacks. For all other value changes, use an update step.
Kind: Assign
Object: Select an object variable to execute the Assign step on.
Assign: Choose a property or relation to assign a value to.
Add: Choose a Has and Belongs to many relation to add an existing record to.
Remove: Choose a Has and Belongs to many relation to remove a record from.
Create
With this step, you can create new data (records) and assign values to its properties and relations.
Kind: Create
Model: Select a model to execute the Create step on.
Assign: Select properties and relations to assign values to.
As: Choose a name for the variable under which the new object will be available.
Skip actions: Select which relevant trigger actions need to be skipped when this step is executed. For example, creating a record triggers After save actions. By clicking the action, the action becomes highlighted. To unselect an action, hold ⌘ (Mac) or Ctrl (Windows) and click the action.
Skip validations: When this setting is enabled, all validations on properties and relations of the selected model are ignored and the record will be created, no matter what.
Skip record reload after save: After a record is saved, the record will be reloaded so the new values will be available in the rest of the action. If this is not necessary, consider turning this setting on to improve performance. Especially when creating multiple records, this can be a significant improvement.
Delete
With this step, you can delete a record when this step is executed.
Kind: Delete
Object: Select an object variable to execute the Delete step on.
Export
With this step, you can export records when this step is executed.
Kind: Export
Reference: Select a Back office View on which the export is based. As each View has its own set of Export definitions, the option which is chosen here will affect the available options in the Export definition setting.
Collection: Select which set of records is going to be exported. This can done through collection variables or Has (and belongs to) many relations.
Export definition: Select which Export definition is being used for the export. The available options are based on the option chosen in the Reference setting. To manage your export definitions, go to the corresponding Views in the Back office and click the Export button in the top right corner.
As: Choose a name for the variable under which the export file will be available in the remainder of the action.
Output filename: Choose a name for the file.
Export variables: Add extra values to be included in the export file. Each variable will be added as an additional column.
Background: With this setting enabled, the export is scheduled for Background processing. This means the export is done as an additional job and will not be immediately available, but can be viewed later in the DOWNLOADS tab in the lower-left corner of the back office. When the setting is disabled, the export will be immediately executed and is available in the remainder of the action.
Import
With this step, you can import records when this step is executed. The data that will be imported must be saved as a .csv or .xlsx file in a file property on a record.
Kind: Import
Object: Select an object variable to execute the Import step on.
Import definition: Select which Import definition is being used for the import. The options shown are not filtered by Model or View in the Back office, all Import definitions are shown.
File property: Select the file property holding the file that is imported when executing this step.
Assign: Add extra values to be assigned to the imported records' properties. Only applies to new records.
Update
With this step, you can assign values to an existing object's properties and relations.
Kind: Update
Object: Select an object variable to execute the Update step on.
Assign: Choose a property or relation to assign a value to.
Add: Choose a Has and Belongs to many relation to add an existing record to.
Remove: Choose a Has and Belongs to many relation to remove a record from.
Skip actions: Select which relevant trigger actions need to be skipped when this step is executed. For example, updating a record triggers After save actions. By clicking the action, the action becomes highlighted. To unselect an action, hold ⌘ (Mac) or Ctrl (Windows) and click the action.
Skip validations: When this setting is enabled, all validations on properties and relations of the selected model are ignored and the record will be updated, no matter what.
Skip record reload after save: After a record is saved, the record will be reloaded so the new values will be available in the rest of the action. If this is not necessary, consider turning this setting on to improve performance. Especially when updating multiple records, this can be a significant improvement.
Public web pages
Authenticate & login user
With this step, you can authenticate users for webpages.More information on Authentication profiles and how to use them can be found here!
Kind: Authenticate & login user
Authentication profile: Select an Authentication profile to execute the step on.
Username: Select a variable which is used for the Username setting in the chosen Authentication profile.
Password: Select a variable which is used for the Password setting in the chosen Authentication profile.
Logout authenticated user
With this step, you can log the current user out of the selected Authentication profile.
Kind: Logout authenticated user
Authentication profile: Select an Authentication profile to execute the step on.
Redirect web page
With this step, you can redirect a web page. For example, a customer is logging in. After the customer is successfully logged in, you can redirect he or she to another web page.
Kind: Redirect web page
Response code: Select a http response code: 301 (permanent) or 302 (temporary).
Redirect url: Set the url to which the user is redirected.
Render web template
With this step, you can render web templates, at a specific time in your action.
Kind: Render web template
Template: Select an existing template or create a new one to render.
Response code: Set a http response code for the template being rendered. The default value is 200.
Properties
Auto increment generate
With this step, you can generate a value on an auto increment property and save the object immediately.
Kind: Auto increment generate
Object: Select an object variable to execute the Auto increment generate step on.
Property: Select an Auto increment property you want to generate a value for.
Note: To be able to use this step, you need to have an auto increment property with the Set automatically checkbox turned off.
Auto increment set
With this step, you can set a value on an auto increment property without saving the object.
Kind: Auto increment set
Object: Select an object variable to execute the Auto increment set step on.
Property: Select an Auto increment property you want to set a value for.
Note: To be able to use this step, you need to have an auto increment property with the Set automatically checkbox turned off.
Pdf generate
With this step, you can generate a Pdf file in one of the Pdf file properties of the selected object.
Kind: Pdf generate
Object: Select an object to execute the Pdf generate step on.
Property: Select a Pdf file property to generate a pdf file for. The template and variables used in the file are managed on the property itself.
Regenerate: With this setting enabled, the file will be regenerated if there was already a file present.
Run in background: With this setting enabled, the pdf generation will be scheduled for background processing. This means the file will not be immediately available. When the setting is disabled, the pdf will be immediately generated and is available in the remainder of the action.
Password: Set a password for the generated pdf file. Make the password static by entering a text value or use a variable to make the password dynamic.
Pdf merge
With this step, you can merge multiple Pdf files of the same property into one single Pdf file. If the Pdf file property didn't contain a file yet, it will be generated before merging. This step is always executed as a background job.
Kind: Pdf merge
Collection: Select a collection to execute the Pdf merge step on.
Property: Select a Pdf file property to merge its files together.
Description: Choose a description under which the file will be available under the DOWNLOADS tab in the lower-left corner of the Back office.
Filename: Choose a name for the file.
Store as download: With this setting, the file will become available for later reference under the DOWNLOADS tab in the lower-left corner of the Back office.
Password: Set a password for the merged pdf file. Make the password static by entering a text value or use a variable to make the password dynamic.
As: Choose a name for the variable under which the merged pdf file will be available in the remainder of the action.
Users
Create betty user
With this step, you can create new application users, using values from the action or webpage.
Kind: Create betty user
Email: Select a variable holding the value used for the new user's email address.
Name: Select a variable holding the value used for the new user's name.
Role: Select one or more roles to be assigned to the new user.
As: Choose a name for the variable under which the new user will be available in the remainder of the action.
No invitation mail: With this setting enabled, you disable the default invitation email sent by the platform. When this setting is disabled, the user receives the default invitation email sent by the platform.
User invite link as: Choose a name for the variable under which the invitation link will be available. This link can then be used in a custom email or other steps. Only available when No invititation mail is enabled.
External
Http request
With this step, you can perform requests and receive responses using HTTP methods, which can be used for further processing. This enables integrations with external systems. Basic knowledge of HTTP methods is required to use this step.
Kind: Http request
Webservice: Select an existing webservice from your application or create a new one.
Webservice endpoint: Select an existing webservice endpoint from your application, based on the webservice selected above or create a new one.
Authentication: Select an Authentication configuration if this is required for the request. It's also possible to select a variable.
Headers: Set values or variables for the Header variables on the webservice endpoint. The available options (in this example header example) are inherited from the webservice endpoint itself.
Path variables: Set values or variables for the Path variables on the webservice endpoint. The available options (in this example path example) are inherited from the webservice endpoint itself.
Query: Set values or variables for the Query variables on the webservice endpoint. The available options (in this example query example) are inherited from the webservice endpoint itself.
Body: Set values or variables for the Body variables on the webservice endpoint. The available options (in this example body example) are inherited from the webservice endpoint itself.
Response as: Choose a name for the variable under which the webservice response will be available in the remainder of the action.
Headers as: Choose a name for the variable under which the webservice headers will be available in the remainder of the action.
Response code as: Choose a name for the variable under which the webservice response code will be available in the remainder of the action.
Error info as: Choose a name for the variable under which the error will be available in the remainder of the action in case the request fails.
Timeout seconds: Set the amount of seconds after which the request fails if it takes too long to receive a response. Default value is 20.
Sftp download
With this step, you can download files from your Sftp server directories.
Kind: Sftp download
Host: Set the host which the step will download the file from. Set a value or variable that approaches the Sftp server.
Port: Set the port required for connecting to the Sftp server. In most cases this is 22.
Remote path: Set the path that points at the directory which contains the file.
As: Choose a name for the variable under which the downloaded file will be available in the remainder of the action.
After download: Choose what to do after downloading the file from the directory. Choose between Do nothing, Move file and Remove file.
Rename path: Set a new path for the downloaded file. This setting becomes available after choosing Move file in the After download setting.
Compression method: Choose a compression method, using the zlib library. Choose between Zlib, Zlib@openssh.com, Both or None.
Timeout seconds: Set the amount of seconds after which the download fails if it takes too long to receive a response. Default value is 5.
Configuration: Select one of the available SSH configurations after saving the step, used for authentication.
Sftp List
With this step, you can access directories of your Sftp server and capture its entries in an array. This array can then be used for further processing. Use this step if more than one file needs to be downloaded or uploaded.
Kind: Sftp list
Remote path: Set the path that points at the directory which contains the needed entries.
As: Choose a name for the variable under which the entries will be available in the remainder of the action.
Host: Set the host which the step will collect the entries from. Set a value or variable that approaches the Sftp server.
Port: Set the port required for connecting to the Sftp server. In most cases this is 22.
Timeout seconds: Set the amount of seconds after which the download fails if it takes too long to receive a response. Default value is 5.
Compression method: Choose a compression method, using the zlib library. Choose between Zlib, Zlib@openssh.com, Both or None.
Configuration: Select one of the available SSH configurations after saving the step, used for authentication.
Sftp upload
With this step, you can upload files to your Sftp server directories.
Kind: Sftp upload
File: Select the file to be uploaded to the Sftp server.
Filename: Set the filename for the file to be uploaded to the Sftp server.
Directory: Set the directory to which the file needs to be uploaded.
Host: Set the host which the step will upload the file to. Set a value or variable that approaches the Sftp server.
Port: Set the port required for connecting to the Sftp server. In most cases this is 22.
Create missing dirs: With this setting enabled, this step will create the directory defined in the Directory setting on the Sftp server if it was not yet present. If this setting is disabled, the directory won't be created and the file will instead be saved in the next possible directory.
Overwrite existing: With this setting enabled, this step will overwrite the file if there is already a file present in the directory defined in the Directory setting.
Compression method: Choose a compression method, using the zlib library. Choose between Zlib, Zlib@openssh.com, Both or None.
Timeout seconds: Set the amount of seconds after which the download fails if it takes too long to receive a response. Default value is 5.
Configuration: Select one of the available SSH configurations after saving the step, used for authentication.
Notifications
Send mail
With this step, you can send emails. For instance, a confirmation email when a customer placed an order.
Kind: Send mail
Template: Select one of the existing email templates or create a new one.
Subject: Set the email's subject by selecting a variable or set value.
To email: Set the recipient's email address by selecting a variable or set value.
To name: Set the recipient's name by selecting a variable or set value.
From email: Set the sender's email address by selecting a variable or set value.
From name: Set the sender's name by selecting a variable or set value.
Cc: Set who'll receive a copy of the sent email.
Bcc: Set who'll receive a blind copy of the sent email.
Template variables: Add values or variables from the action to the email's template. Enter a value at Name and a value at Value to include a variable from the action to the template. E.g. a template variable called customer will become available through {{customer}} in the template.
Attachments: Select one or more files to be included as attachments in the sent email.
Storage property: Set an Email message property in which the sent email needs to be saved after the step. Use this for logging all sent emails.
Track opens: With this setting enabled, you can track the times the sent email is opened in Mandrill. A private Mandrill account is required to use this setting.
Track clicks: With this setting enabled, you can track the times the sent email is clicked in Mandrill. A private Mandrill account is required to use this setting.
Reply to: Set a Reply to email address by selecting a variable or set value.
Utilities
Zip
With this step, you can zip and unzip files from and to (multi) file properties.
Unzip
Kind: Zip
Operation: Select which Zip operation you want to perform. Choose between Unzip and Zip.
Object: Choose a variable that contains the record to which the unzipped file needs to be saved to.
File property: Select the file property in which the unzipped file needs to be saved.
Zip file: Select a variable with the file property containing the file needed to be unzipped.
Zip
Kind: Zip
Operation: Select which Zip operation you want to perform. Choose between Unzip and Zip.
Object: Choose a variable that contains the record with the file(s) needs to be zipped.
File property: Select the file property containing the file(s) that need to be zipped. Can be both File and Multifile properties.
As: Choose a name for the variable under which the zipped file will be available in the remainder of the action.
That were all the action steps we currently have to offer. If you have feedback about any of the steps explained above; we would love to hear about it! Hit us up through the chat bubble in the lower right corner or send an email to support@bettyblocks.com and don't forget to rate this article! :)