Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
rbartley
Specialist II
Specialist II

Mashup error after upgrade to September 2017 release

Hi everyone,

After upgrading our QAP server to the September 2017 release (and even after applying Patch 1 and Patch 2), I am receiving errors in my mashup, while the copy on the pre-September 2017 release works fine.

The error is "TypeError; Cannot read property 'applyBookmark' of undefined'.  At first I though that this was due to the app.bookmark.apply method returning asynchronously, so I used $.when().done, but I still receive the error.  Any ideas?

var strBookMark= strPageURL.substring(9,strPageURL.length);

  console.log('strBookmark',strBookMark);

  console.log('app=',app);

  var promiseBookMark = app.bookmark.apply( strBookMark );

  $.when(promiseBookMark).done(

  function(strSuccess)

  {

  console.log('strSuccess',strSuccess);

Bookmark Error.PNG

1 Solution

Accepted Solutions
ErikWetterberg

Hi,

Perhaps app.model.waitForOpen.then( or app.model.waitForOpen.promise.then( would work?


Erik

View solution in original post

11 Replies
ErikWetterberg

Have you reported that to Qlik support? Sounds like a bug.

Erik Wetterberg

Aiham_Azmeh
Employee
Employee

Hi rbartley‌,

It looks to me like the app model hasn't been loaded yet, try:

app.waitForOpen.promise.then(()=>{

     //[....]

     app.bookmark.apply( strBookMark );

     //[...]

});

Yes, Erik is right, it looks like a bug, we will investigate.

I hope this helps.

aiham

rbartley
Specialist II
Specialist II
Author

Hi Aiham,

Thanks for your reply.  I added the code in your snippet, but this also generates an error:

Cannot read property 'then' of undefined, but I can see that the app has been defined when I write it out to the console and the model appears to have been loaded too.

Bookmark Error2.PNG

Richard

rbartley
Specialist II
Specialist II
Author

Hi Erik,

Thanks for your reply.  This seems rather odd.  I have responded to Aiham's reply below which, unfortunately, hasn't resolved the issue.

Richard

ErikWetterberg

Hi,

Perhaps app.model.waitForOpen.then( or app.model.waitForOpen.promise.then( would work?


Erik

rbartley
Specialist II
Specialist II
Author

Hi Erik,

Bingo!  The second option worked:

app.model.waitForOpen.promise.then(()=>{....}

Any idea why this might be behaving in a different way from all previous versions?  Is it pure coincidence that I haven't encountered this before or is it likely that the model has changed with the new releases?

Regards,

Richard

ErikWetterberg

Hi,

It's a bug, some change somewhere has broken this and nobody has noticed before release.

Are you applying a bookmark programatically immediately when then app is opened? If this happened when a user clicked something you would probably have to be fast to reproduce the error.

Erik Wetterberg

rbartley
Specialist II
Specialist II
Author

Ok, thanks once again.

I'm allowing users to save URLs which contain the bookmark id, e.g  .......?bookmark=b27fe925-267e-4e1e-a55c-98eea4c83063,  and then each time the page is opened I check for a bookmark in the URL and, if found,  apply it.

rbartley
Specialist II
Specialist II
Author

In fact, I noticed that the version of IE we have installed does not seem to recognise the ES6 arrow function, so replaced

app.model.waitForOpen.promise.then(()=>{....});

with

app.model.waitForOpen.promise.then(function(){...});

Here's a link to some information on arrow functions in case anyone finds it useful.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions