Automated workflows - agileChilli
agileBase has a number of workflow features built in that get a lot of use. they work with any app you build using the platform and cover things like auto-setting field values on creation, sending notifications, moving data between views etc.
agileBot can be set up to follow rules for creating new records, editing values in existing records or taking other actions. The rules can be simple or complex, in fact anything that can be represented by a standard view, which makes it really powerful.
This can be used in conjunction with other workflow features such as the ability to send email notifications or generate documents, and many steps can be chained together. Many business processes can therefore be fully automated.
- If the system stores recipes, whenever an allergen is changed, a product spec. doc can be generated and emailed to significant customers
- Automatic invoicing – whenever billable events are added to the system, invoices can be generated and emailed to customers or to your account packages
- Automated todo’s – when a lead hasn’t had any activity in 2 weeks, add a todo to the relevant salesperson’s diary to follow up, syncing to their Google calendar
Creating a rule
Here are the basics.
1) A rule is represented by a view. First create the view to represent the rule. The rule can prompt many actions:
- create a new record
- edit an existing record
- remove a record
- lock a record so it can’t be edited by users in future
- push data to a third party system (using the API)
- generate a document
- send an email
2) Any records which become visible in your rule view will trigger the action selected. So add filters (on a calculation if necessary) to select only the records you wish to trigger the action.
3) If creating or editing a record, the fields in the view will populate the new or existing record. Any fields in the view with the same name as a field in the table will populate that field with it’s data. The view field can be a calculation as well as a standard field.
4) Once the view’s created, go to manage -> workflow
Fill in the options. For ‘Recording the time of the last action’, select a date field in the table the view’s based on. This date will be updated every time the workflow runs. If there’s no relevant date field existing, add one to the table.
Complex sets of rules can be created by chaining workflows together. Each workflow will be set to follow on from the last – for example invoice creation may comprise creating the invoice record and lines, generating a PDF and emailing it to a customer.
If a workflow is kicked off manually (see below), the ID of the record is passed as a filter from one workflow step to another, to ensure all workflow steps operate on the same record.
Workflow steps can also be set to ‘recurse’ i.e. run over and over again until there are no more records left to process, before moving on to the next step. This can be useful for recursive actions such as e.g. adding an allergen to an ingredient, which may then require also adding that allergen to all recipes that include it.
When do workflows run
Workflows can be set to run at a particular frequency, either every 24 hours, every hour, half hour, ten minutes or five minutes.
They can also be set to be run manually by a user – see below.
Finally, a workflow can be set to run whenever a new record is created in a table, or even whenever an existing record is loaded by a user. To set up these last two options, see the Options section under the Manage tab of a table.
These options allow workflows to be useful in many different situations.
If you want your workflow to set the value of a relation find, i.e. link to a particular record, there’s no need to create a calculation for it, just include the ID field for the record you want to link to in the view.
If creating a calculation is easier, you can still do that. Either create a numeric calculation which outputs the internal row ID of the record to link to, or the text of the primary value for the relation. If the latter case, the field for the primary value in the related table should be unique and marked as such in the field options.
To set a relation field to blank, add a numeric calculation with the name of the field as normal, but set it to output the value -1.