Forum Discussion
Embed Power reports in Salesforce using LWC
- Anonymous4 years ago
Hi Anonymous,
I think these should be more related to the LWC limitations, you can check the below link of limitations if they meet your scenario:
Supported Salesforce Targets and Tools - Salesforce Lightning Component Library
Regards,Xiaoxin Sheng
hi Anonymous can you please provide how to you solve this issue as i am also working on the same and my requirement is to embeded power bi report in lwc it would be very helpful
thanks
Rahul Singh Yadav
- Anonymous3 years agoNot applicable
Hi I got the Solution it can be implemented using visualFore Page and by Using Remote@RemoteAction in the apex class and thet VF page can be embeded in LWc component
<apex:page controller="PowerBiEmbedManager" >
<html>
<head>
</head>
<apex:includeScript value="{! $Resource.powerbijs }"/>
<apex:form >
<apex:pageBlock >
<apex:actionFunction name="refreshAccessToken" action="{!getEmbeddingDataForReport}"/>
</apex:pageBlock>
</apex:form>
<div id="myReport" style="height: 2000px;"/>
<script>
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.PowerBiEmbedManager.getEmbeddingDataForReport}',
function(result,event)
{
if(result.embedUrl && result.embedToken){
let reportContainer = document.getElementById('myReport');
let reportId = result.reportId;
let embedUrl = result.embedUrl;
let token = result.embedToken;
let config = {
type: 'report',
id: reportId,
embedUrl: embedUrl,
accessToken: token,
tokenType: 1,
settings: {
panes: {
filters: { expanded: false, visible: false },
pageNavigation: { visible: false }
}
}
};
// Embed the report and display it within the div container.
let report = powerbi.embed(reportContainer, config);
}
})
</script>
</html>
</apex:page>