Builds a funnel action type, which is a step an automation can perform when it runs. Obtained from addFunnelActionType on the controller mappings. Set the description, the configuration fields an administrator fills in, and the name of the function that performs the action. Call build to register the action type; registration is ignored once the app's engine has finished initialising.
Group: Builders
Methods
description(String s)
Returns: FunnelActionTypeBuilder
Sets the description shown to administrators alongside the action name when they pick an action for an automation.
| Parameter | Description |
|---|---|
s | the description text |
doActionFn(String s)
Returns: FunnelActionTypeBuilder
Names the function that performs the action when an automation reaches this step. It is called with the automation context and the values the administrator entered into the action's fields.
| Parameter | Description |
|---|---|
s | name of the global JavaScript function that performs the action |
fieldsFunction(String s)
Returns: FunnelActionTypeBuilder
Names a function that adds configuration fields to the action dynamically, called with the field list each time the fields are needed. Use it when the available options depend on account data rather than being fixed at load time.
| Parameter | Description |
|---|---|
s | name of the global JavaScript function that populates the field list |
addField(String name, String options)
Returns: FunnelActionTypeBuilder
Adds a configuration field to the action from a short field definition string, parsed the same way as other app extra fields.
| Parameter | Description |
|---|---|
name | name of the field, which is also the key its value is stored under |
options | field definition string giving the type and any options |
addField(String name, String text, boolean required, List<String> options)
Returns: FunnelActionTypeBuilder
Adds a configuration field to the action with an explicit label and a fixed list of select options.
| Parameter | Description |
|---|---|
name | name of the field, which is also the key its value is stored under |
text | label shown next to the field |
required | true if the administrator must supply a value |
options | the values offered in the field's drop down |
addFieldWithOptionsFn(String name, String text, boolean required, Supplier optionsFn)
Returns: FunnelActionTypeBuilder
Adds a configuration field whose select options are produced by a supplier function that is called when the field is rendered, so the options can reflect current account data.
| Parameter | Description |
|---|---|
name | name of the field, which is also the key its value is stored under |
text | label shown next to the field |
required | true if the administrator must supply a value |
optionsFn | supplier called to produce the list of options |
build()
Returns: void
Creates the funnel action type from the configured values and adds it to the action type list this builder was created for. Does nothing if the app's engine has already finished initialising.