Assisted variables
Define choice lists once in an app and reuse them in modules
Assisted variables use an Action to populate a list of choices. You can define the action and its input and output mappings once in an app, then reuse that definition in Modules.
For example, a rewards app could provide a list of rewards. Each module can ask an account to choose a reward, while the app handles fetching the list and turning reward IDs and names into choices.
Create an assisted variable
First, configure an action in the app's live version that returns the available choices. The action needs an executable script and an output schema describing its response.
Open Apps, select the app, then open Assisted Variables.
Click Add assisted variable.
Enter a Title, such as "Rewards", and Help text describing the choices.
Select the Assisted action. The list contains actions from the app's live version.
Under Required variables, add any module variables the action's input needs.
Click Create assisted variable.
Each required variable has a Key, Type, and Description. Keys must be lowercase and unique within this assisted variable. Supported types are String, Number, Boolean, Date, and Datetime, plus an Array version of each.
For the rewards example, add business_id with type Number and the description "Business whose rewards should be listed". Modules using this assisted variable must provide a module-wide Number variable with that exact key.
Configure the input and output
After creating the assisted variable, configure Input to assisted action and Map output to choices. These mappings save as you edit. Changes to the title, help text, action, or required variables use the Save button.
Input to assisted action
Construct the input expected by the selected action, using the required variables and any constant values it needs. In the rewards example, map the required business_id variable into the action's business_id field. An account's value of 42 would produce:
The required variables come from the account's module connection when the choices are loaded. See Workflow parameters for help constructing objects and selecting variables.
Map output to choices
Use the action output to produce an array of choice objects. Each object needs:
value: the string stored in the module variable when the account selects this choice.label: the string shown to the account.description: optional text with extra information about the choice.
For example, if the action returns a rewards array with id and name fields, use Map Array to construct one choice object for each reward. Map id to value and name to label:
Use the assisted variable in a module
Add a required app connection for this app to the module.
Create or edit a module variable. In Type, select the app and assisted variable, such as Rewards app / Rewards. Choose the (Array) version to allow multiple selections.
Define the required variables as module-wide variables with matching keys and types. Middle identifies missing variables and offers Create this variable for me. A variable inside a module feature or variable group does not satisfy this requirement.
If the module has more than one required connection to this app, select the Required app connection on the assisted variable's settings page.
When an account connects to the module, it supplies the required variable values and maps the required app connection to its own app connection. Middle uses that connection to call the action and load the choices.
Updating and exporting
The definition is shared wherever it is used. Updating its action, mappings, or required variables affects modules using it, including existing module connections. If you add or change a required variable, update those modules to provide the matching key and type. Accounts may also need to fill in newly required values.
Assisted variable definitions, required variables, and mappings are included in app exports, so they travel with the app when it is imported into another installation.
Last updated
Was this helpful?

