Skip to main content
Community site session details

Community site session details

Session Id : rS0vaMcpS9QHn1AMqvL9kY
Power Pages - Power Apps Portals
Unanswered

Javascript Power BI

Like (0) ShareShare
ReportReport
Posted on 6 Jan 2022 13:20:03 by 9

Hi,

 

I'm embeding a Power BI report through Liquid.

When I'm using the authenticationtype pbiEmbedded, the javascript is recognized perfectly, but when I switch to AAD, it doesn't work.

Someone with the same problem?

 

I assume the problem is the var $(".powerbi")[0]; but I don't know how to put it correctly at the Portal

 

$(function(){
 var embedContainer = $(".powerbi")[0];
 var report = powerbi.get(embedContainer);
 report.on("loaded", function(){
 report.updateSettings({
 panes: {
 filters :{
 visible: false
 },
 pageNavigation:{
 visible: false
 }
 }
 }).catch(function (errors) {
 console.log(errors);
 });
 })
 report.on('dataSelected', function(event){
 console.log('Event - dataSelected:');
 console.log(event.detail);
 })
})

 

 

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on 13 Jan 2022 at 23:44:34
    Re: Javascript Power BI

    Hi @GOInside 

     

    As mentioned, I am not getting any errors when I switch to AAD. Because my portal language is English. 

     

    Probably it may be a bug.  Please raise a helpdesk ticket with Microsoft. 

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • GOInside Profile Picture
    9 on 13 Jan 2022 at 09:47:16
    Re: Javascript Power BI

    Hi @ragavanrajan ,

     

    I put it in the right place, because if I change it from AAD to pbiembedded it works. I found an alternative, putting references in the link such as:


    &filterPaneEnabled=false
    &actionBarEnabled=true
    &bookmarksPaneEnabled=true

     

    GOInside_0-1642067173723.png

     

    I'm wondering if in AAD for being an IFRAME if microsoft doesn't block these javascript references...

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on 12 Jan 2022 at 22:51:42
    Re: Javascript Power BI

    Hi @GOInside 

     

    The script I provided was using AAD. I don't get any error on my console if I switch to the organization. 

     

    I can see your portal language is different. Did you add the script in the proper place?  Below is the right place 

     

    Add the above script in web page > Localized content > Advanced > Custom javascript   

     

    If everything is correct. Then In portal studio> Sync config> Browse the website > Hit Ctrl + F5

     

    Note: Make sure you don't have any adblockers or different extensions. 

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

     

  • GOInside Profile Picture
    9 on 12 Jan 2022 at 13:41:16
    Re: Javascript Power BI

    Any suggestions to get javascript working in AAD?

  • GOInside Profile Picture
    9 on 10 Jan 2022 at 09:43:43
    Re: Javascript Power BI

    Hi @ragavanrajan ,

     

    If I choose the option for Organization, I get the following error. If I choose for Customers it works fine. What I intend to do is use for Organization and then add actionBars that only work for Organization.

     

    GOInside_1-1641806662038.png

     

    GOInside_3-1641807591491.png

     

    GOInside_0-1641806619142.png

     

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on 10 Jan 2022 at 01:16:37
    Re: Javascript Power BI

    Hi @GOInside 

     

    Try the following JavaScript 

     

    $(document).ready(function () {
     console.log(555, "Power BI filter test");
     var embedContainer = $(".powerbi")[0];
     if (embedContainer) {
     var report = powerbi.get(embedContainer);
     report.on("loaded", function () {
     report.updateSettings({
     panes: {
     filters: {
     visible: false
     },
     pageNavigation: {
     visible: false
     }
     }
     }).catch(function (errors) {
     console.log(errors);
     });
     })
     }
    });

     

    Note: Check inspect element and in the console you can see the log which I have added in the script (line 2) 

     

    Add the above script in web page > Localized content > Advanced > Custom javascript 

     

    In portal studio

    1. Sync config and browse the website and hit ctrl + F5 ( hard refresh). 

     

    I can see the script is loading without any error and hiding the filters. 

     

    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

  • GOInside Profile Picture
    9 on 07 Jan 2022 at 09:20:18
    Re: Javascript Power BI

    The report works perfectly. I just want to hide the filters and navigation bar, and later activate the actionBar, but for that the javascript will have to work correctly, which doesn't happen if I change pbiembedded to AAD.

  • ragavanrajan Profile Picture
    7,036 Most Valuable Professional on 07 Jan 2022 at 05:53:31
    Re: Javascript Power BI

    Hi @GOInside 

    I have tested this and it is working properly, please try the below code 

     

    {% powerbi authentication_type:"aad" path:"https://app.powerbi.com/groups/yourgroupid/reports/reportid/ReportSectionf69279fd235144cf118a" %}

     

    Note: The JavaScript you are using is to only enable and disable the filter, there is no relation for authentication type. 

     


    Hope it helps. 
    ------------

    If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#2
Lucas001 Profile Picture

Lucas001 48 Super User 2025 Season 2

#3
KevinGador Profile Picture

KevinGador 44 Super User 2025 Season 2

Loading complete