-
Notifications
You must be signed in to change notification settings - Fork 0
triggers.csv
This page explains the configuration file of triggers.
- Sample
- Parameters
- The
conditionsparameter under which a trigger will execute - The
actionsparameter which a trigger will execute - Zenform typical description format
example/configurations/triggers.csv
See also Zendesk official document, because parameters except slug are based on the Triggers API.
Details of conditions and actions are described in later chapters.
| Name | Type | Req. / Op. | Description |
|---|---|---|---|
| slug | string | Required | The identifier for Zenform ex. trigger_send_mail
|
| title | string | Required | The name of trigger ex. Send E-mail
|
| position | int | Required | An integer to determine execution order of triggers. Triggers are executed in ascending order of this param. ex. -9, 0, 5
|
| conditions.all.fields | string[] | Required | The parts of conditions param under which a trigger will execute |
| conditions.all.operators | string[] | Required | The parts of conditions param under which a trigger will execute |
| conditions.all.values | string[] | Required | The parts of conditions param under which a trigger will execute |
| conditions.any.fields | string[] | Required | The parts of conditions param under which a trigger will execute |
| conditions.any.operators | string[] | Required | The parts of conditions param under which a trigger will execute |
| conditions.any.values | string[] | Required | The parts of conditions param under which a trigger will execute |
| actions.fields | string[] | Required | The parts of actions param which a trigger will execute |
| actions.values | string[][] | Required | The parts of actions param which a trigger will execute |
This parameter can control triggering conditions using conditions.all ( AND conditions ) and conditions.any ( OR conditions ).
Either condition must have at least one condition.
In triggers.csv format, you can describe conditions "When a ticket, whose priority is higher than normal OR which has a tag hello, is updated" as below.
| conditions.all.fields | conditions.all.operators | conditions.all.values | conditions.any.fields | conditions.any.operators | conditions.any.values |
|---|---|---|---|---|---|
["update_type"] |
["is"] |
["Change"] |
["priority","current_tags"] |
["greater_than","includes"] |
["normal","hello"] |
field, operator, and value of each condition are shown as below.
| condition | field | operator | value |
|---|---|---|---|
all[0] ( when a ticket is updated ) |
update_type |
is |
Change |
any[0] ( a ticket whose priority is higher than normal ) |
priority |
greater_than |
normal |
any[1] ( a ticket with a tag hello ) |
current_tags |
includes |
hello |
conditions.all.[fields|operators|values] must be the same size, and also conditions.any.[fields|operators|values].
In the previous example, a size of all conditions.all.[fields|operators|values] is 2, and a size of all conditions.any.[fields|operators|values] is 1.
conditions.[all|any].[fields|operators|values] parameters are merged into an associative array and are sent as conditions parameter in Zendesk API as below.
{
...
"conditions": {
"all": [
{ "field": "update_type", "operator": "is", "value": "Change" },
],
"any": [
{ "field": "priority", "operator": "greater_than", "value": "normal" }
{ "field": "current_tags", "operator": "includes", "value": "hello" }
]
}
...
}See Zendesk official document and the later chapter "Zenform typical description method" for further details of field, operator, and value.
This parameter defines actions executed by the trigger.
In triggers.csv format, you can describe actions "Set a status of the ticket as open, and send an E-mail to the requester" as below.
| actions.fields | actions.values |
|---|---|
["status","notification_user"] |
[["open"],["requester_id","subject","body"]] |
field and value of each action are shown as below.
| action | field | value |
|---|---|---|
| Set a status of the ticket as open | status |
["open"] |
| Send an E-mail to the requester | notification_user |
["requester_id","subject","body"] |
The argument size of value depends on field.
value must be wrapped by an array even if it has only one argument.
You can see that the value of the field status is not "open" but a array ["open"] in the previous example.
actions.fields and actions.values must be the same size because Zenform convert them by element-wise combination.
In the previous example, both of them have 2 elements.
actions.fields and actions.values are merged into an array and are sent as actions parameter in Zendesk API as below.
{
...
"actions": [
{"field": "status", "value": "open"},
{"field": "notification_user", "value": ["requester_id","subject","body"]}
]
...
}See Zendesk official document and the later chapter "Zenform typical description method" for further details of field and value.
If you want to set field or value to the ID of ticket field or ticket form,
use slug instead of the ID,
because Zenform can not get their IDs before creating them.
Set field to slug of the ticket form instead of custom_field_<id>
When there is a ticket field OS as below,
| slug | title | ... |
|---|---|---|
| ticket_field_os | OS | ... |
a condition "When a value of the ticket field OS is iOS" is defined as below,
| slug | conditions.all.fields | conditions.all.operators | conditions.all.values | ... |
|---|---|---|---|---|
| trigger_ios | ["ticket_field_os"] | ["is"] | ["iOS"] | ... |
and an action "Set a value of the ticket field OS to Android" is defined as below.
| slug | actions.fields | actions.values | ... |
|---|---|---|---|
| trigger_android | ["ticket_field_os"] | ["Android"] | ... |
Set value to slug of ticket form instead of the ID.
When there is a ticket form Opinion as below,
| slug | name | ... |
|---|---|---|
| ticket_form_opinion | Opinion | ... |
a condition "When a ticket form is the form Opinion" is defined as below,
| slug | conditions.all.fields | conditions.all.operators | conditions.all.values | ... |
|---|---|---|---|---|
| trigger_opinion | ["ticket_form_id"] | ["is"] | ["ticket_form_opinion"] | ... |
and an action "Change a ticket form to the form Opinion" is defined as below.
| slug | actions.fields | actions.values | ... |
|---|---|---|---|
| trigger_change_form | ["ticket_form_id"] | ["ticket_form_opinion"] | ... |
- Configurations