Category
- Working with Workflows
Reflexive, Before Save, and After Save Workflows
Reflexive workflow
A reflexive workflow is a workflow that is connected to form to control the fields of the form. It can be used to:
- show or hide a field or group
- show a field in read-only mode
- assign a value to a specific field (sub-filter)
- assign a value to a specific field in read-only mode
- show or hide custom buttons of the form
Before save workflow
This is a workflow that is connected to a form to mainly validate the input coming from the fields of the form. Validation can also be done through spreadsheet column settings, but workflows are used for complex logic validations, for example, when a value needs to be validated with respect to another value stored in another spreadsheet. This workflow gets triggered when a user clicks the Save button on the form.
Before save workflow validates processes, executes actions, and gives the output as either true or false. If the output is true, the form will proceed to auto-save the values of the fields to the spreadsheet. If the output is false, then the form will not get saved and will remain open as before. The user can change the values and click Save again. In the case of a false output, an error notification can be sent using a variable that has the error message.
After save workflow
This is a workflow that is connected to a form to trigger an action when a user clicks the Save button.
When a user clicks the Save button, the form will save all the values the user entered to the respective columns in the spreadsheet. This is a built-in functionality of the form. No workflow needs to be used to update the values of the fields in the spreadsheet. Consider a spreadsheet that has three columns: id, name, age and and a form that has only two fields: name, age. When the user enters name and age and clicks Save, the form will automatically save the values of the two fields to the respective columns in the spreadsheet. But for the spreadsheet column “id”, the user will have to use a workflow to generate the id and update it against the corresponding row. In short, if a spreadsheet column is added to the form, the data the user enters in the form will be auto-saved to the spreadsheet on clicking the Save button.
After save workflow gets triggered when the user clicks the Save button. The input to this workflow will be:
- fields and values of the form
- rowid
- edit mode/add mode
When the form is in add mode, that is, a new record is being added, then on clicking the Save button, the form will create a new row and save the record to that row. It will pass the unique id of that row to the entry param of the after save workflow. When the form is in edit mode, it will pass the id of the row that the user is currently editing. Using the rowid, the rest of the actions can be decided.