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 users can click in widgets at run time 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, set Extent changes in the Map widget as a trigger and set Filter data records in the data view used by the List as an action. Because the widgets are data driven, the filter action is applied to the data at the framework 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 that widget. For example, you can synchronize the extent of two Map widgets when users zoom or pan one of them by setting Extent changes of one Map widget as a trigger and change the 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 run in response. The following table describes the five 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.

Data added

A trigger occurs when a data source is added with the Add Data 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 addedData filtering changesExtent changesRecord selection changesRecords created

Add Data

Yes

Chart

Yes

Feature Info

Yes

Filter

Yes

List

Yes

Map

Yes

Yes

Query

Yes

Yes

Search

Yes

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:

TargetAction1Trigger: Data addedTrigger: 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 records2—Mark the records as selected and put them into the Selected features view.

Yes

Business Analyst widget

Select feature—Mark the feature as selected.

Yes

Elevation Profile widget

Select line—Mark the line feature as selected and generate an elevation profile.

Yes

Map widget

Add to map—Add data to the web map or scene as a layer.

Yes

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

Yes

Yes

Yes

Yes

Yes

Zoom to4—Zoom to a specified location.

Yes

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 map5—Display the created records on the map as a new layer.

Yes

1For 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.)

2The 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.

3If a Map widget is configured with both the Zoom to and Pan to actions, then the Zoom to action takes precedence. This means that if the user pans and zooms the map at the same time, the Pan to action is ignored.

4When you add a Zoom to action, you can change the Zoom scale settings in the Action settings window. Choose Custom to adjust the zoom level of the map, or choose Automatic to use the map's default scale. The Zoom to action includes the rotate behavior for web maps and web scenes and the tilt behavior for web scenes.

5When you add a Show on map action, you can customize the symbols for created records. Choose Use custom symbols to customize the fill, outline, transparency, and more for points, lines, and polygons. Choose Use layer defined symbols to use symbols from the layers associated with the current action in the source widget.

Data actions

You can configure data actions for users to process data in the app at run time. 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 in the Action panel of the source widget that provides the run time 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 users choose

The dataset passed to the target varies depending on the source widget. For example, 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: ExportFramework: Set filterMap: Pan toMap: Show on map1Map: Zoom toMap: Add to mapTable: View in table

Add Data

All records

All records

All records

All records

All records

All records2

Chart

All or selected records (statistic data)

All or selected records (statistic data)

Feature Info

All or selected records

Selected records

Selected records

Selected records

Selected records

List

All or selected records

All or selected records

Selected records

All or selected records

All or selected records

Map Layers

All records

All records

Query

All or selected records (query result)

All or selected records (query result)

All or selected records (query result)

All or selected records (query result)

All or selected records (query result)

Table

All or selected records

All or selected records

Selected records

All or selected records

1When you add a Show on map action, you can customize the symbols for created records.

2You can add many types of data with the Add Data widget, but only data types that the Table widget supports (feature layers and scene layers with associated feature layers) can trigger the View in table data action.

When a data action is performed on a target widget, the target widget includes a button for clearing it. For example, when a 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 in 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 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 run time, the 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 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 run time, the 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 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.