Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Partner
Partner

Bookmarks don't work/save in mashup

Hi everyone,

I am trying to make a mashup that allows users to create and use bookmarks. Unfortunately it doesn't work when I test it on Qlik Sense Desktop April 2019. The problem is that the bookmarks don't get saved and disappear when you refresh the page.

My code is based on the standard Grid mashup template:
Q1.PNG

This looks like this (I added the app consumer sales and an object):
Q2.PNG
In this mashup I do the following:
- Click "Bookmarks";
- Click "Create";
- Fill in a title and description -> click "Create";

This results in a bookmark called "This doesn't save":
Q3.PNG 

Problem is, when I refresh the page I don't see my bookmark anymore:
Q4.PNG
I also checked the qBookmarkList where you normally find the bookmarks and they are empty:
qBookmarkList{qItems: Array(0)}

The strange thing is, sometimes it does work and the bookmarks persist even when I refresh or restart my PC. Can anyone help me understand why this doesn't work (and sometimes does?)

Thanks in advance

Labels (3)
1 Solution

Accepted Solutions
Highlighted
ErikWetterberg
Honored Contributor

Re: Bookmarks don't work/save in mashup

Hi,

If you try creating two bookmarks with that code, is the first one saved?

The problem might be that you don't wait for the bookmark.create before saving. In that case try something like this:

app.bookmark.create( title, desc ).then(function(){

    app.doSave();

});

But of course there might be another problem.

4 Replies
ErikWetterberg
Honored Contributor

Re: Bookmarks don't work/save in mashup

Hi,

In Qlik Sense Desktop you need to save the app, since that's where the bookmark is saved.

Partner
Partner

Re: Bookmarks don't work/save in mashup

Hi Erik,

Thanks for the quick reply. I tried saving the app, but it doesn't work. I used it like this:

case 'createBm':
var title = $( "#bmtitle" ).val(), desc = $( "#bmdesc" ).val();
app.bookmark.create( title, desc );
$( '#createBmModal' ).modal( 'hide' );
//In Qlik Sense Desktop you need to save the app, since that's where the bookmark is saved.
app.doSave();
break;

It didn't do anything as far as I can see and I also don't get any errors in the console.

Highlighted
ErikWetterberg
Honored Contributor

Re: Bookmarks don't work/save in mashup

Hi,

If you try creating two bookmarks with that code, is the first one saved?

The problem might be that you don't wait for the bookmark.create before saving. In that case try something like this:

app.bookmark.create( title, desc ).then(function(){

    app.doSave();

});

But of course there might be another problem.

Partner
Partner

Re: Bookmarks don't work/save in mashup

Brilliant, it works!

I also used it when I delete my bookmarks, like this:

app.bookmark.remove(bookmarkId).then(function() {
app.doSave();
});

This also works. Thanks for all the help, really appreciate it!