CRM Analytics Aura Events - Update Event

Create a custom component to dynamically set filters in a CRM Analytics dashboard embedded in a Lightning page.

This event works with embedded dashboard components. Embed your CRM Analytics dashboard in a Lightning page (see the Embed CRM Analytics Dashboards in Lightning Pages help topic for more information). Be sure to save and activate your page.

The CRM Analytics Aura events allow CRM Analytics to interact with the UI container. In this example, we create a custom component to interact with the embedded CRM Analytics dashboard, so you need some familiarity with the Developer Console. See the Lightning Aura Components Developer Guide for more information.

In the Developer Console, create an Aura Component named filterTest, and copy the following into the component markup definition (filterTest.cmp):

Replace the XXXXXXXXXXX with the fully qualified developer name of your dashboard. To find the name, use uCRL or Postman to execute the API call /services/data/v47.0/wave/dashboards. The developer name is required and it must be the fully qualified name - <namespace>__<devName>.

For most filters, you need the fully qualified name of the dataset the dashboard is using. To find the name, log in to Workbench, click Utilities | REST Explorer. In the text box, type /services/data/v47.0/wave/datasets and then click Execute.

Add a controller (filterTestController.js) to the bundle, then copy the following JavaScript into it. This example JavaScript shows how to construct the payload for the update event—in this case, setting StageName to Closed Won for the dataset used by the dashboard. Replace these names with valid names from your dashboard and dataset, for the filter you wish to set. For more information about creating the filter, see Filter and Selection Syntax for Embedded Dashboards.

Add a Style (filterTest.css) to the bundle and copy the following CSS into it.

Finally, add a design (filterTest.design) to the bundle and copy the following into it.

That’s it. You can use your custom component to interact with CRM Analytics. Add your custom component to the Lightning Page with your embedded dashboard. Make sure that the developer name in the filter matches that of the dataset in the dashboard you embedded. Applying your filter by clicking the “Fire” button causes the dashboard to be updated.

For more information about Aura events and other Lightning development features, see the Lightning Aura Components Developer Guide.