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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Power BI Embedded getBookmarks not working with grouped/nested bookmarks

Hi,

 

I was trying to get the bookmarks from an embedded report using bookmarksManager.getBookmarks() and it was giving me the error "Cannot read property 'getSdkBookmark' of undefined".

This is where it throws on the minified reportEmbed.min.js

t.prototype.getSdkBookmark = function(t) {
            var e = this;
            if (!t)
                return null;
            if (O.isBookmarkGroup(t))
                return {
                    name: t.name,
                    displayName: t.displayName,
                    children: _.map(t.children, function(t) {
                        return e.getSdkBookmark(t)
                    })
                };
            var n = {
                displayName: t.displayName,
                name: t.name,
                options: t.options,
                explorationState: E.serialize(t.explorationState)
            }
              , r = JSON.stringify(n)
              , o = jsCommon.GzipUtility.compress(r);
            return {
                name: t.name,
                displayName: t.displayName,
                state: o
            }
        }

It gets the list of childrens fine, but on trying to run getSdkBookmark on each child it throws saying the e is undefined.

 

At first I though it might have been something different with the newer version of powerbi.js but I found that the sample report works fine. So after more experimentation, I found that it was only happening to reports that have a nested bookmark.

 

Has anyone else had this problem? I cant replicate the problem on the embedded playground tool as they dont have any reports with nested bookmarks.

 

Please help.

 

Thank you in advance.

Status: Needs Info
Comments
v-jiascu-msft
Employee

Hi @hoonybro90,

 

Can you give some details of "nested bookmarks", please? It seems not an official name. 

Did you mean the announcing-personal-bookmarks-in-the-power-bi-service/?

 

Best Regards,

Dale

v-jiascu-msft
Employee
Status changed to: Needs Info
 
hoonybro90
Advocate IV

Hi @v-jiascu-msft

I was referring to bookmark groups, i think that is the actual name for them.

Its the feature where you can group the bookmarks to keep them tidy.

 

I have also found a way to replicate this problem on the embed playground.

- load a sample report in edit mode

- in the interact tab, under bookmarks run `enable bookmarks pane`

- in the bookmarks pane, right click any bookmark and click `Group`

- back in the interact tab, under bookmarks run `Get bookmarks`

 

This will not print anything in the Log windows as it is throwing an error which you can check using the developer tools.

I have submitted a support ticket about this error and just received first contact.

 

you may mark this thread as completed if you like.

 

Thank you

hoonybro90
Advocate IV

Got a reply from the team.

They are going to be implenting the fix in the backend.

Their approximate timeline is about a month to implement and go through whole deplyment process.

 

Hope this helps anyone else having the same issue as me until it gets patched.

furmangg
Frequent Visitor

When you have bookmark groups, how do you tell the Power BI JavaScript embedding API to navigate to a bookmark inside a group. 

 

report.bookmarksManager.apply("Bookmark1234");

That code only seems to work for top-level  bookmarks not bookmarks in a group.

 

BTW, in the latest JavaScript API it appears that bookmarksManager.getBookmarks() does return the top level bookmarks and top level groups and you can expand the group to see its children bookmarks. But I just don't know how to navigate to a bookmark in a group.