Skip to content

Bookmarks

Amit Shuster edited this page Apr 1, 2020 · 17 revisions

By using bookmarks in Power BI, you can capture the current configured view of a report page, including filtering and the state of visuals.

Bookmarks in Power BI

To read about bookmarks in Power BI please refer to Bookmarks Documentation.

Bookmarks API

In embedded report, developers can:

  • Get a list of bookmarks.
  • Apply a bookmark on report load or during session.
  • Reload a report without a bookmark applied.
  • Capture the event of bookmark applied.
  • Show/Hide the bookmarks navigation pane.
  • Enter/Exit bookmarks presentation mode.

In addition, developers can:

  • Capture and get a current view as a bookmark object.
  • Apply a captured bookmark state on report load or during a session.

Bookmark definition

interface IReportBookmark {
    name: string;
    displayName: string;
    state: string;
}

name: unique identifier of a bookmark. displayName: a display name which will appear in a bookmarks navigation pane. state: a Base64 serialization of a bookmark state. You can save it and apply it back to the report using bookmarksManager.applyState method.

Apply bookmark on load

To apply a bookmark on report load please read Embed-Configuration-Details

Code Samples

Get a list of bookmarks.

    // Get a list of bookmarks
    let bookmarks = report.bookmarksManager.getBookmarks();

Apply a bookmark by name

    // apply a bookmark with a name: Bookmark1234
    report.bookmarksManager.apply("Bookmark1234");

Reload a report without a bookmark applied.

    report.reload();

Capture the event of bookmark applied.

    // Listen on bookmark applied event and log the applied bookmark name to browser console.
    report.on("bookmarkApplied", (event) => {
        console.log(event.detail.name);
    });

Show/Hide the bookmarks navigation pane.

    // Show bookmarks navigation pane
    report.bookmarksManager.updateSettings({
        bookmarksPaneEnabled: true
    });

    // Hide bookmarks navigation pane
    report.bookmarksManager.updateSettings({
        bookmarksPaneEnabled: false
    });

Enter/Exit bookmarks presentation mode.

    // Enter presentation mode
    report.bookmarksManager.play(models.BookmarksPlayMode.Presentation);

    // Exit presentation mode
    report.bookmarksManager.play(models.BookmarksPlayMode.Off);

Capture and get a current view as a bookmark object, and apply it back on the current session.

A captured state can be saved in application database, and can be applied back on a report in different sessions. Managing permissions and usage of the new bookmark is done by the application.

    // Capture the current view
    let capturedBookmark = report.bookmarksManager.capture();

    // Applied previously captured state
    report.bookmarksManager.applyState(capturedBookmark.state);

Note: When using the bookmark APIs, changes to the report may cause an error or an unexpected result. For example, changes to the report may include removing report filters. To avoid errors in this example, the corresponding filters cards should be present. Instead of removing the filters you should set their values to “all”. If you don’t know which filters were deleted or changed, you can recapture the bookmark after the changes to the report were applied.