CRM Analytics Aura Events - Asset Loaded Event

React to the CRM Analytics asset rendering completion event.

For this example, the CRM Analytics asset used is a dashboard. The dashboard component generates a Lightning event when it has fully loaded and rendered its state (widgets, steps, and queries). This event is sent: on the initial load of a dashboard, when a user resets to dashboard to the initial view, and when the user selects a dashboard view. The payload for this completion event is the asset type and asset id. This example shows how to receive the payload and display the results.

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.

Using the Developer Console, create an Aura component named assetLoaded. Copy the following markup into the component.

Add a Controller (assetLoaded.js) to the bundle and copy the following JavaScript into it:

This example listens for any asset to be loaded and then displays the type and id of the asset. For greater functionality, combine this code with the wave:selectionChanged event example code to build a component that listens for asset loaded events and informs the user of the dashboard status so the user knows when to safely make updates to the dashboard.

You can now use your custom component to interact with a CRM Analytics dashboard component. In the Lightning App Builder, add your custom component to the Lightning Page with your embedded dashboard. That’s it. Save and view the page to see the wave:assetLoaded event in action.

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