Example Triggers
Triggers
Triggers are a feature of Enterprise plans.
Triggers are rules that are applied to submissions that arrive in your team's Submissions area.
You can set up triggers to automatically email users, to validate submissions, trigger other workflows, or export to 3rd party solutions such as Dropbox.
Creating a Trigger
- Go to Submissions area of your team.
- Select Triggers (bottom right)
- Choose Add Trigger
- Enter name of trigger (eg. "Trigger to send an email to my boss"
- Choose the type of trigger - based on the type you select, you will get a sample trigger with default form fields displaying. Use the Advanced Editor for any customisation of the form fields you see displayed.
- To see if a trigger ran on a submission, go to the Submission in the Admin area. Choose Advanced. Choose View Event Log.
- You should see the trigger logged if it has run successfully.
Advanced Editor
The advanced editor is a toggle mode to allow you to edit the Trigger rule directly. This is in JSON format (see https://www.json.org/ ).
For more advanced triggers, you will need to use the Advanced Editor.
Example Triggers
Please note that the below examples are showing the "advanced editor" view which we recommend using for advanced customisations.
{"email" : "me@example.com"}
Email to Field
{"field":"Project Manager Email"}
Email with Conditions
{
"email" : "me@example.com",
"conditions": [
{
"field": "_name",
"expected_value": "Form A"
}
],
"cc_author":false
}
Email with Custom Subject
This example shows a few fields concatenated together.
eg. If the Form Name was "My Form" and the Submission Description was "Job 123", the subject would be set to be "My Form - Job 123".
{
"email" : "me@example.com",
"subject" :
[
{
"type" : "field",
"value" : "_name"
},
{
"type" : "text",
"value" : " - "
},
{
"type" : "field",
"value" : "_description"
}
]
}
Email to Group
Emails submission to every user in the team that matches the supplied group type.
{"group":"administrators"}
Email with Review Mode
When review mode is configured, the user will be taken to the submission viewer within th team. Important note: the recipient must be a team member with reporter or administrator rights.
{"email":"fred@organisation.com", "review_mode": true}
eg 2:
{"group":"administrators", "review_mode": true}
Email with Status
This is useful for status change notifications .
{"email":"fred@organisation.com", "include_state": true}
MailChimp Subscribe
Please note you need to integrate your FormTab account with MailChimp before this trigger will work. To do this you must be the account owner and activate the integration here.
{
"type" : "mailchimp","api_key" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxx",
"list_id" : "xxxxxxxxxx",
"email_field" : "Enter Your Email Address",
"matchon":"_name",
"matchval":"Form A"
}
Dropbox
Please note you need to integrate your FormTab account with Dropbox before this trigger will work. To do this you must be the account owner and activate the integration here.
{ "folders": [ { "type": "field", "value": "_name" }, { "type": "field_date", "date_format": "Y-m", "value": "_device_created" } ], "export_type": "pdf", "export_name": [ { "type": "field", "value": "_name" }, { "type": "text", "value": "_" }, { "type": "field_date", "date_format": "Y-m-d", "value": "_device_created" }, { "type": "text", "value": "_" }, { "type": "field", "value": "_reference" } ] }
Xero
Please note you need to integrate your FormTab account with Xero before this trigger will work. To do this you must be the account owner and activate the integration here.
The Xero trigger doesn't require any values in the JSON. Below is all you need to enable the trigger sending your submissions to your Xero inbox.
{}
If you don't require all submissions to be sent you can use the following JSON to define which form submissions you would like sent to your Xero inbox.
{ "conditions": [ { "field": "_name", "expected_value": "Form A" } ] }
Document Trigger
{
"matchon":"_name",
"matchval":"Sample Form - Part A",
"generate":"Sample Form - Full",
"recipient":"fred@example.com",
"target_community":"347fbc23425575b4b8512c6c4aa5"
}
- The target community is the team that you want the second form to be created in. eg. you may have a Sales team and a Management Team; part A would sit in the Sales Team and the full form would sit in the Management team. To get your target community you can go to your team settings and retrieve your "TEAM TOKEN"
- Data is copied where there a match on the label - therefore, ensure your labels always match in the two forms
- Additional conditions beyond the "matchon" are supported, but optional. See Email with Conditions for example of conditions.
- Recipients can be defined in a field as follows:
eg. the sender email:
"recipient_is_field":true,
"recipient":"_username"
eg2. a form field (label name):
"recipient_is_field":true,
"recipient":"Staff Email Address"
Sharefile
{ "subdomain": "yoursubdomain", "tld": "domain.com", "username": "yourusername@domain.com", "password": "yourpass", "base_folder": "base/folder/", "folders": [ { "type": "field", "value": "Job ID" }, { "type": "concat", "value": [ { "type": "field", "value": "Project Name" }, { "type": "text", "value": "." }, { "type": "field", "value": "Address" } ] }, { "type": "field", "value": "_name" } ], "export_type": "pdf", "export_name": [ { "type": "field", "value": "_name" }, { "type": "text", "value": "_" }, { "type": "field_date", "date_format": "Y-m-d.h.i", "value": "_device_modified" } ] }
Description
{ "matchon":"_name", "matchval":"PO Number", "description" : [ { "type" : "text", "value" : "PO-" }, { "type" : "field", "value" : "_user_ref" } ] }
Tag
{"field":"_username"}
Validate
{
"matchon":"_name",
"matchval":"Ground Survey",
"conditions": [
{
"field": "report",
"expected_value": "NOT NULL"
}
]
}
Webhook
NB. matchon + matchval are supported
{"url":"https://test.webhook.co.nz/formtabwebhook"}
Webhook (Version 2)
Version 2 of the webhook JSON data includes the following:
- Table fields contained within an array
- UMT timestamped dates
- Attachment filename information
- URL and PDF links for optional use
- Verification for API users ( based on HMAC hash of timestamp, random token and your API key; to validate compare hmac with your own hash eg. hash_hmac('sha256', $timestamp.$token, $BillingUser->api_key) )
{"url":"https://test.webhook.co.nz/formtabwebhook","version":2}