Example: checking a rental caravan
Build step by step a flow that creates a check task with subtasks after departure, or raises the priority of the open task
Last updated on
This example builds a flow with a filter, Find task, Set task priority, an If / else and a task with subtasks. You do not need an API request for it.
In Tillor demo environments this flow is already there as a paused example under the name Rental caravan check. You can look at it there while you build along.
What the flow does
A guest leaves a static caravan. The caravan has to be checked before the next guest.
- If there is no open check task for that terrain yet, the flow creates one, with five subtasks and a deadline after 7 days. The task also goes to the colleague who ended the occupation
- If there is already an open check task, for example because the caravan became free twice shortly after each other, the flow does not create a second task. Instead the priority of the existing task goes up one step
The two task steps at the bottom are almost the same. Only the description differs: if the system ended the occupation, there is no colleague to mention.
What you need
- You have the permission Manage automations, or All permissions
- Your organisation has a terrain type for static caravans, in this example Static caravan
- Optional: a board and a column for the check tasks
Building the flow
1. Creating an empty flow
- Go to Admin > Automations and click New automation
- Choose Start from scratch
- In the breadcrumb at the top, fill in the name Rental caravan check
- Click on the canvas, next to the steps, and in the panel fill in under Description what the flow is for
2. Setting up the trigger
- Click the trigger. Leave Starts from on When something happens
- Under Event choose
occupation:ended. Type occupation to search - Under Step name give the step the name Occupation ended
Now the flow starts for every occupation that ends. You want it only for static caravans:
- Under Only when click Add condition
- Click Variable and choose
occupation.terrain.terrainTypeId - Leave the comparison on is
- For the value, choose the terrain type Static caravan
3. Finding an open check task
- Add a Find task step, connect the trigger to it and name it Open check task?
- Under Title fill in
Check {occupation.terrain.name} - Leave Linked to the records of the event, Only tasks that are not completed and Skip subtasks on
The step now looks for a main task that is not yet completed, is called exactly Check followed by the name of the terrain, and is linked to the same terrain, the same customer or the same reservation. Then the flow continues via Found or Not found.
4. Raising the priority
- Add a Set task priority step, name it Raise priority and connect the Found exit to it
- Leave Task on
{foundTask.id} - Leave Change on One step higher and Raise up to on High
5. Checking who ended the occupation
- Add an If / else step, connect the Not found exit of Open check task? to it and name it Ended by a colleague?
- Click Add condition and under Variable choose
triggeredBy.id - Choose the comparison is not empty
{triggeredBy.id} is empty if the system ended the occupation, for example a scheduled task. Then the flow goes via No.
6. Creating the task
Add a Create task step, name it Create check task and connect the Yes exit to it. Fill in the fields like this:
| Field | Value |
|---|---|
| Title | Check {occupation.terrain.name} |
| Description | Generated automatically., an empty line, and Occupation ended by @{triggeredBy.name}({triggeredBy.id}) |
| Priority | Low |
| Due after | 7 days |
| Also assign whoever caused the event | On |
| Link to records | On |
| Subtasks | Five lines: Cleaning, Inventory, Internet + TV, QR code frame, Check for odd jobs |
With @{triggeredBy.name}({triggeredBy.id}) the colleague is mentioned in the description. If you want the task to go on a board, choose a board under Add to board and a column under Column. Whoever must always receive the task, you choose under Assign to.
Keep the title the same as in Open check task?. Otherwise the search step will not find the task the next time.
7. The task for the system
- Click the step Create check task and then Duplicate step
- Name the copy Create check task (system) and connect the No exit to it
- Set the Description to only
Generated automatically.
8. Testing and enabling
- Check that there is no issues button (such as 1 issue) at the top of the panel
- Open the Test run tab and click Run test. You see which path the flow takes and which title and description the task would get. Nothing is created
- Turn the Active switch on
Why two steps instead of one
You can also use the Find task and Set task priority steps separately. If, for example, you want to do nothing when the task already exists, simply connect nothing to Found. If you want to give the existing task a comment or a different status, put another step after Found, such as Set task status with {foundTask.id}.
What happens in practice
| Situation | What the flow does |
|---|---|
| No open check task for this terrain | Creates a new task with five subtasks |
| Open task with priority Low | Sets it to Medium |
| Open task with priority Medium | Sets it to High |
| Open task with priority High or Urgent | Leaves the priority as it is |
| Occupation on a different terrain type | Does not start |
What the task looks like in Tillor
The task is in the name of Workflow and is linked to the terrain and the customer of the occupation, and to the reservation if there is one. Not every occupation has a reservation. The colleague who ended the occupation is on the task as the assigned person.