Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

rbartley
Contributor III

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
erik_wetterberg
Honored Contributor

Re: Mashup error after upgrade to September 2017 release

Hi,

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


Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
11 Replies
erik_wetterberg
Honored Contributor

Re: Mashup error after upgrade to September 2017 release

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

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
Employee
Employee

Re: Mashup error after upgrade to September 2017 release

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
Contributor III

Re: Mashup error after upgrade to September 2017 release

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
Contributor III

Re: Mashup error after upgrade to September 2017 release

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

erik_wetterberg
Honored Contributor

Re: Mashup error after upgrade to September 2017 release

Hi,

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


Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
rbartley
Contributor III

Re: Mashup error after upgrade to September 2017 release

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

erik_wetterberg
Honored Contributor

Re: Mashup error after upgrade to September 2017 release

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

Erik Wetterberg
https://extendingqlik.upper88.com/
rbartley
Contributor III

Re: Mashup error after upgrade to September 2017 release

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
Contributor III

Re: Mashup error after upgrade to September 2017 release

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

Community Browser