• Prathima Maradala 3
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello All ,
I am facing a problem while filtering a wave dashboard from a lightning component . Do I need any SDK license for wave:update event to trigger?
below is my code .Please let me know if I am going wrong any where?
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="evtValue" type ="String" access="GLOBAL" />
    <aura:attribute name="eqpmtNumb" type="String" access="GLOBAL"/>
    <aura:attribute name ="dashboardId" type="String" access="GLOBAL" default="0FK1D000000001OWAQ"/>
    <aura:attribute name="developerName" type="String" access="GLOBAL" default=""/> 
    <!--<aura:handler name="init" value= "{!this}" action="{!c.doInit}" /> -->
    <aura:registerEvent name="update" type="wave:update"/>
    
    
    <lightning:input type="input" label="EVT_CD" aura:id="evt" value="{!v.evtValue}"/>
    <lightning:input type="input" label="EQPMT_NUMB" aura:id="eqpmt" value="{!v.eqpmtNumb}" />
    <lightning:button variant="brand" label="Get data" title="Clicki To Refresh Data" onclick="{!c.handleUpdate}" />
  </aura:component>

Controller:
({ handleUpdate: function(component, event, type)
    {
        var getEvtVal = component.find("evt").get("v.value");
        var getEqpmtVal= component.find("eqpmt").get("v.value");
        var dashboardId ='0FK1D000000001OWAQ';
        alert('getEvtVal '+getEvtVal);
        alert('getEqpmtval '+getEqpmtVal);
        
        if(getEvtVal != null || getEqpmtVal != undefined)
        {
            helper.evtFilter(component);
            var event = $A.get('e.wave:update');
            event.setParams({
                id:dashboardId,
                value:getEvtVal,
                type:"dashboard"
            }
            );
            event.fire();
        }
        if(getEqpmtVal != null || getEvtVal !=undefined)
        {
            helper.eqpmtFilter(component);
            var event = $A.get('e.wave:update');
            event.setparams({
                id:dahboardId,
                value:getEqpmtVal,
                type: "dashboard"
            });
            event.fire();
            
        }
    }
})

Helper: 
({
    evtFilter : function(component, event, helper) {
        var getEvtVal = component.find("evt").get("v.value");
        var evtFilter = {
            datasets: {
                "Unit_Tracing": [{
                    fields: [
                        "EVT_CD"
                    ],
                    evtFilter: {
                        operator: "in",
                        values:[
                            getEvtval
                        ]
                    }
                }]
            }
        };
        
        var evtFilterJSON = JSON.stringify(evtFilter);
        component.set("v.evtValue",evtFilterJSON);
                                               
        
    },
    eqpmtFilter : function(component, event, helper) {
        var getEqpmtVal = component.find("eqpmt").get("v.value");
        var eqpmtFilter = {
            datasets: {
                "Unit_Tracing": [{
                    fields: [
                        "EQPMT_NUMB"
                    ],
                    eqpmtFilter: {
                        operator: "in",
                        values:[
                            getEqpmtval
                        ]
                    }
                }]
            }
        };
        
        var eqpmtFilterJSON = JSON.stringify(eqpmtFilter);
        component.set("v.eqpmtValue",eqpmtFilterJSON);
                                               
        
    },
})
I use Visual Force lightning out to display an analytics dashboard from another Salesforce Org. There are two Salesforce Orgs (Source Org and Target Org) in this context. 

Source Org:
1) Created analytics dashboard
2) Created lightning component and app to embed analytics dashboard.

Target Org:
1) Created a VF page and used lightning out to pull above created lightning app and component which displays dashboard.
2) Used REST API for authentication, where session Id Source Org has been generated using username and password oAuth route.
3) Defined CORS, Analytics Whitelists, CSPs in source and target orgs respectively.

While opening VF page in target org, page is getting loaded but not the dashboard rather dashboard spinner appears forever. From Developer tools, i get below error:
 
Refused to display  'https://xxxxxxx.salesforce.com/?ec=302&startURL=%2Fanalytics%2Fwave%2FembeddedWave.apexp%3Fmode%3DassetView%26formFactor%3DDESKTOP%26showHeader%3Dfalse%26embeddedInstanceId%3Dewa-5905390847443092%26context%3Daura%26height%3D300px%26sfdcNsOrigin%3Dhttps%253A%252F%252Fxxxxxxx.visual.force.com' in a frame because it set 'X-Frame-Options' to 'deny'.

Note: If i login into source org in the same browser then refreshing target org's visual force page renders the analytics dashboard.