Wave SDK

wave:sdk

Use this component to add access to the Tableau CRM SDK in a Lightning Experience page.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App

The wave:sdk component allows you to invoke a set of Analytics REST API calls as SDK methods inside Lightning components and Visualforce pages. Discover Analytics assets and their details and create, update, and delete Analytics apps from templates.

Reference the wave:sdk component in your code:

1<aura:component implements="force:appHostable,force:hasRecordId">
2    <wave:sdk aura:id="sdk"/>
3</aura:component>

To call the SDK, use sdk.invokeMethod(context, methodName, methodParameters, callback) and specify your parameters.

This example uses the wave:sdk component to get a list of dashboards. Your org must have CRM Analytics enabled and at least one dashboard created for this example to work live. Click the “List Dashboards” button to trigger the SDK call. The component code can be copied and modified to work in any DE org.

1<aura:component implements="force:appHostable" access="global" description="This is for the wave:sdk auradoc example only">
2   <aura:attribute access="global" required="false" name="dashboards" type="Object[]" default=""/>
3
4   <wave:sdk aura:id="sdk"/>
5
6   <lightning:layout>
7        <lightning:layoutItem size="12" class="slds-p-around_x-small">
8            <lightning:card title="SDK listDashboards Example">
9                <lightning:layout verticalAlign="start">
10                    <lightning:button onclick="{!c.listDashboards}" label="List Dashboards"/><br />
11                    <lightning:layoutItem size="6" class="slds-p-right_x-small">
12                        <label><b>List of Dashboards</b></label><br />
13                        <aura:iteration items="{!v.dashboards}" var="dashboardItem">
14                            <p><b>Id: </b>{!dashboardItem.id}<b> Label: </b>{!dashboardItem.label}<b> Name: </b>{!dashboardItem.name}</p>
15                        </aura:iteration>
16                    </lightning:layoutItem>
17                </lightning:layout>
18            </lightning:card>
19        </lightning:layoutItem>
20   </lightning:layout>
21
22</aura:component>

The client-side controller calls the helper function to list the dashboards.

1({
2  listDashboards: function (component, event, helper) {
3    helper.listDashboards(component);
4  },
5});

The helper function calls invokeMethod() with the method parameters.

1({
2  listDashboards: function (component) {
3    var sdk = component.find("sdk");
4    var context = { apiVersion: "47" };
5    var methodName = "listDashboards";
6    var methodParameters = {
7      pageSize: 200,
8      sort: "Name",
9    };
10    sdk.invokeMethod(
11      context,
12      methodName,
13      methodParameters,
14      $A.getCallback(function (err, data) {
15        if (err) {
16          console.error("listDashboards Error: ", err);
17        } else {
18          var dashboards = data.dashboards;
19          component.set("v.dashboards", dashboards);
20        }
21      })
22    );
23  },
24});

For more information, see the Analytics Template SDK.

Attributes 

NameDescriptionTypeDefaultRequired
bodyThe body of the component. In markup, this is everything in the body of the tag.Aura.Component[]

Methods 

NameDescriptionArgument NameArgument TypeArgument Description
invokeMethodInvoke CRM Analytics SDK MethodcontextObjectThe context for the API call.
methodNameStringThe name of the SDK method to invoke.
methodParametersObjectThe parameters for the SDK method.
callbackfunctionThe callback function to run after the SDK method completes.