Overview
Authors can configure dynamic form inputs to map a dropdown list box or radio group to a data variable instead of manually typing every option. This data can exist in any of the following namespaces:
- Actions
- Transforms
- Views
- Form Data
As the content of the data changes, so will the dynamic values making this a great option for large ever-changing data sets.
Note: CX Actions is required to use the Actions, Transforms and Views namespaces. If your account does not have CX Actions enabled, you will limited to the Form Data option only.
Adding a Dynamic Form Input from the Actions Namespace
Dynamic Form Inputs are available on List Box and Radio Button form field types. Rather than typing in a list of options that may change over time, you can pull the values of those options from your various data sources.
First, be sure that you have an External Source configured as well as a Connected Object in your Workflow that is called before reaching the node that will show your Dynamic Form Input(s).
- To add a Dynamic Form Input on a Content Node click the Add Form Field button. Then choose the List Box or Radio Button option depending on your preference.
- Switch the Field Type to Dynamic
-
You'll now see these options available to you:
In the example above we want our List Box to display a list of authors that are available in a database of authors and famous quotes. https://dummyjson.com/quotes. This database includes values like these:
To configure the list box to display all of the authors from our data source in a List Box field the options are set as follows:
Variable: This is the main variable for this field. In our example we named it
authors_and_quotesbut this can be anything you like. The value will become what is selected and mapped in the other options as described below.Source Variable Type: Set this to use the namespace location of your data.
- Actions: Data that resides in the Actions namespace
- Transforms: Data that resides in the Transforms namespace
- Views: Data that resides in the Views namespace
- Form Data: Data that resides in Form Data
Variable Name: The syntax for your variable name should be in a format like this example:
alias.variableIn our quotes example, the alias of our Connected Object is
get_quotes. Reference your Connected Object node to get its value:Our variable name becomes
get_quotes.quotesbecause the name of our array in our database is quotes.Variable Placeholder Preview: This is created automatically based on your source and your variable name.
Label Attribute: Set this to the attribute you would like to see populated in your List Box or Radio Button options. In our case we want a list of authors, so we have set our label attribute to
author.Variable Attribute: This is the value of the selected option. In our case, we want the value to hold the actual quote from our database, so we have set it to
quote.Score Attribute: This is an optional score variable. If you have a score variable set on your main variable, you can assign a score attribute here.
- Now our dynamic list of Authors will show like this:
- And the dynamic result like this:
- We set our label attribute to author to display the list of authors, and we set our value attribute to quote. So our main variable name of
show_authors_and_quoteswill display the quote of the selected author.${show_authors_and_quotes}or${your_main_variable_name}
Adding a Dynamic Form Input from the Transforms Namespace
Transformation functions are a powerful feature of CX Actions, that allows you to manipulate and transform data within your workflows using JavaScript. These functions can leverage Workflow form data (key-value pairs) or Workflow actions data (dynamic data) to perform complex operations.
Data that you have transformed using transformation functions in a Script Node can also be leveraged in Dynamic Form Inputs.
- If your data resides in the transforms namespace, set the Source Variable Type to Transforms.
- In our example workflow of authors and quotes we have a script that transforms the data into summaries. It formats the results and and stores them like this:
- Now we can use that transformed data in our Dynamic Field configuration.