Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
See also
How-To Make Choices In Workflows: Choosing Paths based on Toggle, Dropdown, or Segment Fields
Workflows are most useful when you can use the information entered by your field workers to drive the decision process. This is done using a combination of a Read Asset/Job/Request connector and Exclusive Branching conditions.
On each branch apart (apart from the default) you define a condition that must be met for that branch to run. With Exclusive Branching only one branch must match, so each condition must be exclusive (ie not overlap). The safest way to do this is to use Toggle, Dropdown, or Segment Fields. For simple yes/no or on/off, use a toggle and then have two branches - set one to yes/on and leave the default as no/off. For Dropdowns or Segmented fields, you should set up one branch for each individual case that needs special handling and then let the default branch handle all other cases. Using these three fields types ensures that the conditions will be exclusive.
The branching conditions also support things like equal or not equal to an arbitrary text string. This will work but requires more care. If you have many branches you will need to make sure the conditions can’t accidentally overlap.
Consider the Exit Inspection workflow shown above (click on the diagram to zoom it up). This is a simple version of the process that a property management company may follow at the end of a residential tenancy.
It starts with an Exit Inspection trigger (1). When an Exit Inspection request is Accepted, this workflow is run. The next step is to read the data in the Inspection form (2).
The third box is an Exclusive Branch. It checks a field “Did the property pass inspection?”, which is a toggle field in the Exit Inspection form. If it passed inspection then it takes the path shown at (4). This goes straight to creating the email to the letting manager that the inspection process is complete.
If it failed the inspection then it goes to the maintenance section, shown in the blue dotted outline.
Node (6) is a parallel branching. Each branch is done at the same time. This way the cleaning and the garden maintenance can all be done by different people but they don’t need to wait for each other. Each branch continues at its own pace and at (10) Gruntify will wait till all three branches are completed before proceeding.
Nodes (7), (8), and (9) are all Exclusive Branches, following the same pattern. The fields Needs Internal Clean, Needs External Clean and Is Garden Maintenance Required are segmented fields, with the values “No”, “Tenant to Organize” and “Agent to Organize”. The branch tests are set up so that if the value = “Agent to Organize” the then AGENT TO… branches are taken and a job created to get the work done. If either “No” or “Tenant to Organize” are selected then the default branch is used and no action is taken by the agent. All the work should be completed before the Reinspection (10) is done. When the Reinspection is complete (11) then the workflow can go on with triggering the email.
; AND Tests
Jump Straight to
Table of Contents | ||||
---|---|---|---|---|
|
Data Flow
Copying values from Asset to Request to Job
Workflows are designed to do one task based on a previous task, with data flowing between tasks. So, given an asset, a request, and a job, how can we match up the fields?
(1) Make sure you have a Read Asset/Request connector. This makes the data from the Asset/Request available to later connectors in the workflow. Select the appropriate form on the Output Data tab of the Read connector.
(2) If you are trying to copy values from a Request Details tab from a Request to a Job, turn on the “Job Details” toggle as shown in the picture below.
(3) Use the Parameter type when entering data in the Input Data fields. From the field type drop downs, switch them from Text/Number to Parameter if needed.
The diagram below gives you an idea of which fields match. You may decide to do it slightly differently, such as using the Customer Asset Name (from Asset) as the Client Reference (Request).
Parameter Selection Box Problems
My Parameter Selection box in an Email Connector is empty. What do I do?
You are missing a “Generate Link” connector. There must be one further up the workflow. If you have one in the workflow, make sure it proceeds the email connector, and it isn’t on a separate branch.
Have this?
You need this!
My Parameter Selection box does not show the fields in the Asset/Job/Request form. What do I do?
In the Read Asset/Job/Request connector, go to the Output tab and select the form type. Gruntify does not automatically select the matching form so you need to select the form that is used to create the Asset/Job/Request.
Have this?
Want This?
You need this!
If after both of the above you still can’t see what you’d expect, try this.
Saving and Older Versions
I made a change and then changed my mind. How can I get my old version back?
Go to the View History option in the top left-hand corner of the Builder view. This will display a list of older versions of your Workflow. You can look at a thumbnail of each version and when you find the one you want, restore this older version as the current version.
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Emails
How can I get information from an Asset/Job/Request and include it in my Email?
The text in the email sent by the Email connector cannot be modified, but you can include a link to an Asset, Job, or Request in the email. The recipient can then look at the details directly in Gruntify.
This ensures that the person looking at the email will not be looking at an out-of-date version of the details.
If the Asset, Job, or Request is already in the Workflow, all you need to do is add a Link connector, then reference the Link Connector.
Click on the screenshot on the right to zoom the image, and watch the video below to see how to set up the Email connectors.
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Do I need to link my Email to an Asset/Job/Request?
No, you don’t. The fields where you create the link are optional so you can just send a fixed text email.
Can I include a non-Gruntify link in an Email?
If you want to include a URL in your emails, such as a web page on your company website or training page, then you can include it using the Action Button fields. This will give you a single button at the bottom of the email for the user to click.
You cannot use HTML to embed multiple links in your email - the HTML will appear as regular text in the email.
How can I send an email to someone who is not a user in my workspace?
You cannot do this. You can only send to users in your workspace.
This is to reduce the chance that Gruntify sent emails will be seen as SPAM emails, protecting your organization and Gruntify from a SPAM email complaint.
Advanced Input
The Parameter Selection box doesn’t show me the options I expect, what can I do?
First, if you’re looking for fields that are on your form, try the steps here.
When you’re selecting a parameter, the selector tries to help you out by refining the results to only display fields that match the data type expected by the input. Sometimes, this will mean that you won’t see options you expect because the data types don’t match.
Take the ‘Send Email’ task for example, the ‘To Users’ input expects an Array of Email Addresses. If you wanted to use a text field on your form to determine who receives the email, you won’t find any form fields in the parameter dropdown for ‘To Users’. Thats because text fields are a String type, not specifically an Email Address type.
If you want to override this behavior, you can do that with the ‘Advanced Input’ option in the input type dropdown. This option allows you to write your own expression in JavaScript syntax. For our purposes here, this will just be:
The ID of the Read Request/Job/Asset task in the Workflow
The word ‘form’
The control ID of the text field in the form
TIP! An Array input can accept one or more values. If you’re only supplying one value, you don’t need to wrap it in square brackets.
You can see an example of this below, where ‘TextField-3usf’ is a text field on the form where you can enter an email address.
Info |
---|
Control Labels vs Control IDs When you are setting up your form in the form builder, each control has 2 options that you can specify that help identify that control. The ‘Label’ is what your users see written above the input, and is how you will see controls referred to by the Parameter Selector. On the other hand, the ‘Control ID’ is the internal identifier used to refer to that control by Gruntify apps under the hood. Each control has a default ID which is unique, but if you’d prefer you can change it to something more human-readable. |
With the above example saved, we can now send emails dynamically based on the form field we specified! This use-case can be applied to other parameter inputs where the data types don’t match as well. The only thing to keep in mind is that some data types can’t be automatically converted (for example, a word can’t be converted into a number). If your data doesn’t match the required input type and it can’t be converted, your Workflow will fail when it runs.
I want to automatically compute a field by manipulating other data, is that possible?
Absolutely! With Advanced Input, you can define your own JavaScript expressions that perform any number of calculations or manipulations to come to a result. This is not for the faint of heart though, as you will need to understand how to write JavaScript to process your data.
First, find an input that you’d like to compute the result of - this can be a field in a Request/Job/Asset form, or a standard task input. Using the input type dropdown (in the top-right of any input field), select ‘Advanced Input’. Then, when you click on the input box, you should see the Expression Editor as below:
To start you off, the editor will suggest ‘Key classes’ - these are the task IDs of tasks in your Workflow which contain output data you may want to manipulate (such as Read Request/Job/Asset tasks). This is not an exhaustive list of available tasks with outputs.
In the expression text area, you can start writing JavaScript to compute your result. It should be noted that when we say that this is a JavaScript ‘expression’, you can think of that as anything that you would be able to put on the right-hand side of a variable assignment. As such, you cannot:
Assign variables inside the expression
Use any keywords like: for, if, return, break, etc.
Start a new block scope
Here are some examples of valid expressions:
Simple addition
Code Block | ||
---|---|---|
| ||
request1234.form.number_one + request1234.form.number_two |
Map/Reduce
Code Block | ||
---|---|---|
| ||
asset1234.form.repeater_control
.map((repeaterEntry) => repeaterEntry.text_field)
.reduce((a, b) => a + "\n" + b) |
Index accessor
Code Block | ||
---|---|---|
| ||
job1234.assetIds[0] |
If you get stuck and would like some assistance with Advanced Input in Workflow Studio, feel free to create a support ticket in our customer portal. Our technicians will be happy to help you out with your custom expressions.
Related articles
Filter by label (Content by label) | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|