Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
m4pv
Frequent Visitor

config pageName, load/render functions

Hello, we need to display the first page of the embedded reports (PowerBI Embedded, App owns data).

I used two methods described below and these both worked fine for some time. But it seems that these methods do not work consistently. We've noticed that after deploying code to web server the first page of the reports is not always opened first.

I also tried locally in .Net code and have the same issue. 

 

1st way: using pageName in config where defaultPageName is a variable:

 

 var models = window['powerbi-client'].models;
 var config = {
        pageName: defaultPageName,
        type: 'report',
        tokenType: models.TokenType.Embed,
        accessToken: embedToken,
        embedUrl: embedUrl,
        id: embedReportId,
        permissions: models.Permissions.All,
        settings: {
            filterPaneEnabled: false,
            navContentPaneEnabled: true
        }
    };
    var reportContainer = pageDocument.getElementById('reportContainer');
    var report = powerbi.embed(reportContainer, config);

 

 

2nd way: using load/render functionality as defined in https://powerbi.microsoft.com/en-us/blog/power-bi-developer-community-january-update/

where pageIndex is a variable:

 

 var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: embedToken,
embedUrl: embedUrl,
id: embedReportId,
permissions: models.Permissions.All,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: true
}
};
var reportContainer = pageDocument.getElementById('reportContainer');
var report = powerbi.load(reportContainer, config);

report.on('loaded', function () { report.getPages() .then(function (pages) { if (pages[pageIndex].isActive == false) { pages[pageIndex].setActive() .catch(function (errors) { Log.log(errors); }); } }) .catch(function (errors) { Log.log(errors); }); report.render(config); });

 

 

Does anyone else have similar issue?

 

Thanks

1 ACCEPTED SOLUTION
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @m4pv,

 

According to your description above, I have tested it a few times. The default page option in config works fine for me without any issue?

 

Note that the value set for the pageName should be real report name(but not the display name of the report page) which you can find from the report url on Power BI service.

https://app.powerbi.com/groups/7d855170-da1f-43aa-9c40-475f7d84ff4c/reports/9622bdcd-eef4-4ec1-880f-3916bb7d471c/ReportSection

In addition, if the issue persists, I would suggest you create a new issue here for better assistance. Smiley Happy

 

Regards

View solution in original post

2 REPLIES 2
v-ljerr-msft
Microsoft Employee
Microsoft Employee

Hi @m4pv,

 

According to your description above, I have tested it a few times. The default page option in config works fine for me without any issue?

 

Note that the value set for the pageName should be real report name(but not the display name of the report page) which you can find from the report url on Power BI service.

https://app.powerbi.com/groups/7d855170-da1f-43aa-9c40-475f7d84ff4c/reports/9622bdcd-eef4-4ec1-880f-3916bb7d471c/ReportSection

In addition, if the issue persists, I would suggest you create a new issue here for better assistance. Smiley Happy

 

Regards

 Hi @v-ljerr-msft

The problem with 1st method was indeed the fact that i was assigning .displaName to config.pageName and not the .name value. 

Is there a way to either set actual tab names (in pbi desktop or pbi service) or get them programmatically prior loading the report object? Getting these from url is not an option.

 

I don't see what was the issue with 2nd method (load / render / pages[0].isActive / pages[0].setActive() functions). Perhaps it's related to this bug. So for now i just get a real name value and use it to add to config:

    report.on('loaded', function () {
        report.getPages()
            .then(function (pages) {
                config.pageName = pages[pageIndex].name
                report.render(config);
            })
            .catch(function (errors) {
                Log.log(errors);
            });
    });

Hopefully that will work.

 

Thanks

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.