Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
AKN
Partner - Contributor III
Partner - Contributor III

Calling openApp on a non authorized user in mashup

Hi,

I have an array of app ids. However if current user is not authorized on the app it gives "Forbidden" error. I don't want to try to open the app if it gives error and continue with next app id.

 

for (let i = 0; i < appIds.length; i++) {
    getSheet(appIds[i]);
}

function getSheet(_appId) {
    qlik.openApp(_appId, config);
}

 

I've tried the last answer of this thread but still error pops up and for loop breaks:

https://community.qlik.com/t5/Integration-Extension-APIs/Forbidden-app-for-the-current-user-Qlik-Sen...

 

Labels (3)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

Hi @AKN , you should be able to manage errors using "on" method and looking for errors. When a user cannot open an app your on error function should be triggered and then you can manage them. Please see this example.

View solution in original post

3 Replies
alex_colombo
Employee
Employee

Hi @AKN , you should be able to manage errors using "on" method and looking for errors. When a user cannot open an app your on error function should be triggered and then you can manage them. Please see this example.

AKN
Partner - Contributor III
Partner - Contributor III
Author

Thank you, this works!

However whenever console.log("error", _appId) runs it logs all previous app ids that gave an error too it logs all previous app ids even if they didn't give any error. Do you think that's because how on method works or my code is broken somehow?

 

openApp.on("error", function (error) {
  console.log("error", _appId);
});

 

For example

if appid = "1" gave an error it logs

"error 1"

and after that appid = "2" gives an error then it logs

"error 1"

"error 2"

appid = "3" doesn't give any error.

appid = "4" gives an error and then:

"error 1"

"error 2"

"error 3"

"error 4"

and so on.

 
 

 

 

alex_colombo
Employee
Employee

Your code is ok, this could be a bug. If you want you can open a support case for further investigation. Thanks!