Add actions to widgets

You can do the following to create dynamic and interactive apps with Experience Builder:

  • Connect widgets with data and configure them with dynamic content.
  • Configure interactions between a widget and the framework (data source).
  • Configure interactions between widgets.

You can add two types of actions to widgets: message actions and data actions. Message actions listen to triggers and perform actions automatically, such as filtering a list to show only records within a map’s current extent. Data actions provide an Actions button that end users can click in widgets at runtime and select from a list of actions to perform, such as exporting records to a file.

Message actions

Experience Builder apps are data-driven, which means that the data displayed by widgets can change universally when the underlying data updates. You can define interactions between a widget and the data by configuring message actions in response to triggers. For example, you can create an interaction such that when the Map widget changes its extent, the other widgets (such as a List) are filtered and display only features within the current extent. To do this, you'd set extent change in the Map widget as a trigger and filter records in the data view used by the List as an action. Because the widgets are data-driven, the filter action is applied at the framework and data level and every widget using the same data view is synchronized automatically. You can also define interactions between widgets. Actions provided by a widget only take effect within itself. For example, you can synchronize the extent of two Map widgets when users zoom or pan one of them by setting extent change of one Map widget as a trigger and change extent of the other Map widget as an action.

These interactions are defined and managed in the Action panel of the source widget that provides the triggers. The Message action configurations have three parts:

  • Triggers from the source widget
  • Targets that respond to the trigger (widgets and the app framework)
  • Actions from the target related to its intended use

The source widget’s trigger can only be added once; however, you can add multiple actions for that specific trigger from the same or a different target.

Triggers

Triggers are events generated by the source widget. Once a trigger occurs, any actions added to it are executed in response. The following table describes the two triggers that are currently supported:

TriggerDescription

Data filtering changes

A trigger occurs when a filter is applied to the data source.

Extent changes

A trigger occurs when the map’s extent changes via panning, zooming, resizing, and so on.

Record selection changes

A trigger occurs when a record is selected or a selected record is cleared.

Records created

A trigger occurs when result records are loaded in the source widget.

To view a widget’s available triggers, open its settings and click Add a trigger on the Action tab. The following table lists source widgets and their supported triggers:

Source widgetData filtering changesExtent changesRecord selection changesRecords created

Chart

Yes

Feature Info

Yes

Filter

Yes

List

Yes

Map

Yes

Yes

Query

Yes

Yes

Search

Yes

Yes

Table

Yes

Targets

Targets perform the actions. A target can be a widget or the framework. If you choose the framework as the target, the action is performed globally—throughout all relevant widgets and pages in the app.

Actions

Unlike the triggers that are defined by the framework, actions are provided by targets (especially widgets) to perform specific business logic. Some actions may need additional configuration depending on how the target handles the message from the trigger. For example, if you’re configuring a filter action for a data view and the trigger is based on different data, you can filter the target data view by establishing an attribute or spatial relationship. You can also set SQL conditions.

Different targets provide different actions that correspond to different triggers. Available actions appear once you add a trigger and select the target. The following table lists targets and their corresponding actions:

TargetAction*Trigger: Data filtering changesTrigger: Record selection changesTrigger: Extent changesTrigger: Records created

Framework

Filter Data Records—Keep only the records in the data view that meet the conditions for further display or processing through the app.

Yes

Yes

Select Data Records**—Mark the records as selected and put it into the Selected features view.

Yes

Map widget

Pan to—Keep the current scale and center on a specified location.

Yes

Yes

Yes

Yes

Zoom to—Zoom to a specified location.

Yes

Yes

Yes

Yes

Flash—Flash a feature on the map.

Yes

Filter—Keep only the features that meet the conditions for viewing in the map widget.

Yes

Show on map—Display the created records on the map as a new layer.

Yes

*For framework actions, if the action data is the default view, the action will affect all widgets using the data and its views. If the action data is a specified view, the action will only affect the widgets using that view. For widget actions, the action will only perform on the target widget. (For example, the map filter action will only filter the records in the map and won’t affect all other widgets using the same layer.)

**The selected state of a record is synchronized throughout the app and the selected records are saved in the data’s Selected features view. Widgets may have a different configuration for displaying a selected record.

Data actions

You can configure data actions for end users to process data in the app at runtime. They can click the Actions button on source widgets and choose to pass a dataset to a specific widget (such as viewing query results in a table) or the app framework (to export data).

These interactions are defined and managed on the Action panel of the source widget that provides the runtime dataset. The Data action configurations have two parts:

  • Targets that receive the dataset (widgets and the app framework)
  • Data actions provided by the target, performed only when end users choose

The dataset passed to the target varies depending on the source widget. For example, the List widget can only pass selected records to the Table widget, and the Chart widget passes all statistic data to the Table widget, whether or not there is a selection. The following table lists available source widgets, targets and supported data actions (target: data action), and the dataset that each source widget passes for each applicable action.

Source widgetFramework: ExportMap: Zoom toMap: Pan toMap: Show on mapTable: View in table

Chart

All or selected records (statistic data)

N/A

N/A

N/A

All records (statistic data)

Feature Info

Selection

Selection

Selection

Selection

Selection

List

All or selected records

Selection

Selection

Selection

Selection

Query

All or selected records (query result)

All records (query result)

All records (query result)

All records (query result)

All records (query result)

Table

All or selected records

Selection

Selection

Selection

N/A

When a data action is performed on a target widget, the target widget includes a button for clearing it. For example, when an end user selects data in a List widget and chooses to view the selection in a Table widget, a button appears next to the new sheet that allows them to remove the sheet from the table. Similarly, when they choose the Show on map data action, a button appears in the map to clear it from the map. (Refreshing the page will clear all data action results.)

Configure interactions

Configure message actions and data actions on the Action panel of the source widgets.

Configure message actions

Message actions are configured in the settings of the source widgets (the widgets that provide triggers).

  1. In the Action panel, on the Message action tab, click Add a trigger.
  2. Select the trigger, select the target, and add and select the actions.

    Some actions, such as Filter, Flash, and Select Data Records, require additional configuration. The Action settings options appear when you select the action. Each trigger can only be added once.

  3. To add multiple actions for the same trigger, click Add action.

    Actions for the same trigger occur in sequential order.

  4. Drag the actions grouped under a trigger to change the order.
  5. To modify these configured settings later, click the action’s Settings button Settings.
  6. To change an action or target after adding an action, delete it and add a new one.

    Deleting a trigger also deletes all the actions added to it.

Configure data actions

Data actions are configured in the settings of the source widgets, with the exception of Export, which is configured for the data source in the Data panel. Data actions are enabled by default, and the widget's Actions button automatically includes all its available data actions.

  1. In the Action panel, on the Data action tab, uncheck or check the data actions to specify the options for the widget's actions menu. Otherwise, turn off Enable data action to exclude the Actions button from the widget.
  2. For each checked data action, select target widgets for the source widget to interact with, such as a Map widget.

    You can only select target widgets that are on the same page as the source widget.

    Note:

    When you add a target widget to a page, its corresponding data actions are automatically added to available source widgets on the same page.

    Tip:

    For best results, position the source widget next to the target widget because data actions don't jump to the target location in the app.

  3. To exclude the Export data action, go to the Data panel and turn off Allow export for the data source.

Example usage

Add message actions to support app design requirements such as the following:

  • You want to build an app that compares two maps, two scenes, or a map and a scene, so the extents of the two Map widgets should always be synchronized. You can add an Extent Changes trigger to both widgets, select the other widget as the target for each, and choose the Pan to or Zoom to action.
  • You add a List widget next to a Map widget and you want the list to only display the records within the map’s current extent. You can add an Extent Changes trigger to the Map widget, select the Framework’s Filter Data Records action, choose the action data as the data view configured in the List widget settings, and configure the action with a spatial relationship to the extent.

Use data actions to support app design requirements such as the following:

  • You add a Chart widget to represent a set of numerical or qualitative data as a graph, and you want to give the end user an option to view statistics data generated by the chart in a Table widget. When you add a Table widget next to the Chart widget, the View in table data action is added to the Chart widget automatically. At runtime, the end user can click the Actions button in the Chart widget and select View in table to display the statistics data in the Table widget.
  • You add a List widget to display a data record and a Map widget to display a different data record. You want to provide the end user with an option to show a feature on the map that corresponds with a record selected in the list to compare different data on one map. At runtime, the end user can click the Actions button in the List widget and select Show on map.
  • You display data records in a Table widget and want end users to have the option to export the data. With Allow export enabled for the data source, they can click the Actions button on the Table widget and choose to export selected records or all records (up to 5,000).