Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm trying to build a mashup that allows the user to cycle between the QlikSense apps and display the theme applied to the QlikSense app.
I can open the apps and cycle between them, however when I use the method app.theme.getApplied it always retrieves a JSON with the default theme (sense), although my custom theme is set in QlikSense.
var app = qlik.openApp(appId, config);
app.theme.getApplied().then(function(qtheme){
console.log(qtheme);
});
Using the qlik.getThemeList() method displays all the themes, including my custom themes, so I can confirm that my theme is properly installed.
Is there any other method I should be using or should I use the API in other way?
Thanks!
Hi @gabineaq
By any chance are you using qlik.theme.apply('themenameid');?
Please refer to the following documentation:
Kind Regards.
Hi @Gabi
@Nadia is correct. In a mashup, the theme always defaults to the Qlik Sense default theme, not the one applied inside the app in the hub.
Therefore you need to first apply the theme in the mashup ( qlik.theme.apply('themenameid'); ) to be able to get it with app.theme.getApplied()
As far as I am aware, there is no method directly available in the Capability APIs to fetch the theme applied in the hub. You would need to use the Engine API (GetObject()) to get the object of type "appprops" and perform a GetProperties() if you want to do that.
https://help.qlik.com/en-US/sense-developer/November2020/apis/EngineAPI/services-Doc-GetObject.html
You can use the browser devtools in the hub when viewing the app properties to understand what is the workflow.
Hi @gabineaq
By any chance are you using qlik.theme.apply('themenameid');?
Please refer to the following documentation:
Kind Regards.
Hi @NadiaB,
Thank you for your reply.
I'm trying to get the apps and their associated themes. For example, in QlikSense App1 uses customTheme1, App2 uses customTheme2, App3 uses default theme. I can get the app, the objects, but I can't get the themes set by the admin in QlikSense. Using app.theme.getApplied() always returns the default theme - sense, not my custom themes: customTheme2, etc.
I have consulted the linked documentation and according to it app.theme.getApplied() should get the currently applied theme. As far as I understand, it should get the theme set by the user in QlikSense.
I'll use qlik.theme.apply('themenameid'); after I will get the id of the theme associated to the application.
Thanks!
Is there a way or API method that displays the existing Apps and the themes associated with them?
Hi @Gabi
@Nadia is correct. In a mashup, the theme always defaults to the Qlik Sense default theme, not the one applied inside the app in the hub.
Therefore you need to first apply the theme in the mashup ( qlik.theme.apply('themenameid'); ) to be able to get it with app.theme.getApplied()
As far as I am aware, there is no method directly available in the Capability APIs to fetch the theme applied in the hub. You would need to use the Engine API (GetObject()) to get the object of type "appprops" and perform a GetProperties() if you want to do that.
https://help.qlik.com/en-US/sense-developer/November2020/apis/EngineAPI/services-Doc-GetObject.html
You can use the browser devtools in the hub when viewing the app properties to understand what is the workflow.
Hi @Damien_V ,
Can i get a example i have a task that is related to this
need the applied theme ID from the application & apply it on my mashup
In mashup it returns : id: "sense"
which is not the theme i have applied i have multiple applications linked, want to do di dynamically
app.theme.getApplied().then(function(qtheme){
console.log( 'Current theme' , qtheme);
});