---
schema_version: "1"
id: 55755f788a9613bee1818717080abd89e34b00c0e8a83549fd6c51c5c2f51d45
title: CRM Analytics Aura Events - Discover Event
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sdk/guides/bi-sdk-web-example-discoverdashboard.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sdk/guide/bi-sdk-web-example-discoverdashboard.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1f7e7a44aafe2fbdc7a1379c45e032e29f8810e5628ffabda17315f333e806ce
products:
  - Analytics SDK Developer Guide
  - analytics
---

# CRM Analytics Aura Events - Discover Event

This event sends a request to CRM Analytics dashboards to identify their assets.

## Example - Setting Up Your Request and Receiving a Response

The _wave:discover_ event sends a global request to listening CRM Analytics dashboard assets to respond with their identifying information (via the _wave:discoverResponse_ event). You can include your own parameter in the response.

The _wave:discover_ and _wave:discoverResponse_ events work hand-in-hand. They’re particularly useful for discovering when a dashboard is being added dynamically to the page, or whether the page has multiple dashboards.

Using the Developer Console, create an Aura component and copy the following markup into the component. The markup sets up the handlers for the events, and adds buttons for adding a dashboard and for discovering dashboards.

```nolang
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <aura:handler event="wave:discoverResponse" action="{!c.handleDiscoverResponse}"/>
    <aura:registerEvent name="discoverEvent" type="wave:discover"/>

    <ui:inputText label="Dashboard Name" aura:id="idTextBox"/>
    <ui:button label="Add Dashboard" press="{!c.addDashboard}"/>
    <ui:button label="Are you there?" press="{!c.discoverDashboard}"/>
    {!v.body}
    <ui:outputText aura:id="outName" value="" class="text"/>
</aura:component>
```

Add a controller to the bundle, then copy the following JavaScript into it. This code shows how to fire the _discover_ event, and how to use the result when the _discoverResponse_ event is fired. The code also shows how to create dashboard components.

```nolang
({
    addDashboard: function(component, event, helper) {
        var selectCmp = component.find("idTextBox");
        var config = {
            "developerName": selectCmp.get("v.value"),
            "showHeader": false,
            "height": 400
        };
        $A.createComponent("wave:waveDashboard", config,
            function(dashboard, status, err) {
                if (status === "SUCCESS") {
                    dashboard.set("v.rendered", true);
                    dashboard.set("v.showHeader", false);
                    component.set("v.body", dashboard);
                } else if (status === "INCOMPLETE") {
                    console.log("No response from server or client is offline.")
                } else if (status === "ERROR") {
                    console.log("Error: " + err);
                }
            }
        );
    },
    discoverDashboard: function(component, event, helper) {
        $A.get("e.wave:discover").fire();
    },
    handleDiscoverResponse: function(cmp, event, helper) {
        var myText = cmp.find("outName");
        myText.set("v.value", event.getParam("developerName"));
    },
})
```

That's it! You can use these events to get some context about available dashboard components, and then interact with them via the _Update_ and _selectionChanged_ events.

## Resources

For more information about Aura events and other Lightning development features, see the [Lightning Aura Components Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/intro_framework.htm).
