Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

nguyendeana
New Contributor

App IDs and Object IDs change when deploying

MashUp reference App IDs and Object IDs to embed QlikSense content into it.

For deployment from Test server to Production server, we'll need to do export (from Test server)  and import (to Production server) of both the mash up &  the application(s) that the mash up uses.

From what I understand during the export/import of application, the Apps ID and all Objects IDs of the app will be changed. Hence, once deploy to Production server, you will have to manually updated your mash up to reference the new IDs. I am looking for a process to make the deployment process much more automate.

Can we use name instead of ID ?

               For application: I think it will works as long as you make sure that your app name is unique.

               For object within the app: How do you find out the name of the object ? is it the same as the title?

Is there any other better way for deployment?

7 Replies

Re: App IDs and Object IDs change when deploying

ID's are allocated when things are created, so on an export / import the App ID will certainly be different Test vs. Prod.  But on publishing an app from the the Work Stream to another stream the App ID of the target app will remain as is.

Individual Object ID's within an App should remain unchanged.  But if an object is copied from one app to another app then the a new target object will be created and this will have a new Object ID.

What I have done with mashups is have some if statements to open the correct App ID as per the hostname, like this but I have changed the names in the below to protect the innocent :

/* On localhost QlikSense Desktop */

if  ( hostName == 'localhost' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('MyApp.qvf', config);

} ;

/* On QlikSense Dev Server  DevServer.net */

if  ( hostName == 'DevServer.net' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('DevAppID', config);

} ;

/* On QlikSense TestServer.net' */

if  ( hostName == 'TestServer.net' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('TestAppID', config);

} ;

/* On QlikSense ProdServer.net' */

if  ( hostName == 'ProdServer.net' ) {

console.log ( 'Detected Host: ' , hostName ) ;

var app = qlik.openApp('ProdAppID', config);

} ;

I'd be interested if anyone else has a better and less hard coded method.

Chanty4u
Esteemed Contributor III

Re: App IDs and Object IDs change when deploying

yes it will change.

but  when you done any changes in app and moving to server you have replace with old app then it will not change the app id and object ids as wwell.

msariga7
New Contributor

Re: App IDs and Object IDs change when deploying

Hi ,

           Facing the same situation now.

           Were you able to find a good solution for this?

            If yes, please let me know.

Thanks in advance!

daniela_reinhar
New Contributor II

Re: App IDs and Object IDs change when deploying

The Problems are the same everywhere.

We are using Mash ups where the App ID is need as well.

So far our workaround looks like this:

- App id is replaced by a unique naming of the Apps. This is working fine, but we still have an manageable amount of apps. Also once you have published apps and use those IDs, you can keep publishing updated versions from the same or another server instance into the app and then the App ID will remain.
- The App Id's don't change and that's how working with the mash ups is possible.

msariga7
New Contributor

Re: App IDs and Object IDs change when deploying

Thanks a lot for the prompt reply Daniela!

Will follow this.

John_Twisk
New Contributor

Re: App IDs and Object IDs change when deploying

I found a way that is using the STREAM-name and APP-name to retrieve the unique app-id. This means that the combination of stream-name and app-name must be unique in your environments. The development-, test-, and produktion-environment must have the same configuration of streams and app-names available for it to work. But this shouldn't be a problem.

The big advantage with this approach is that you ONLY have to know the stream-name and app-name you want to retrieve. NO MORE difficuilt id's to remember! This little function really makes my life easier, managing deployments between different Qlik-Sense environments.

Below you will find the function "getAppIdByStreamAndAppName" which takes the Stream-name and Application-name (without file-type) as in-parameters and finds the app-id for the current connection (config). The app-id is returned in a promise and can then be used further...

/////////////////////////////
//FUNCTION
/////////////////////////////
function getAppIdByStreamAndAppName(inStreamName, inAppName){ //Function returns the app-id as a promise
return new Promise(function(resolve, reject) {
	qlik.getGlobal(config).getAppList(function(list){
		for (var i = 0; i < list.length; i++) {
			if(list[i].qMeta.stream){
				console.log(list[i].qDocName);
				console.log(list[i].qMeta.stream.name);
				if(list[i].qDocName==inAppName && list[i].qMeta.stream.name==inStreamName){
					//FOUND THE APP IN THE STREAM...
					const activeConfigeAppId = list[i].qDocId;
					resolve(activeConfigeAppId); //RETURNS THE APP-ID
					break;
				}
			}
		}
	});
})
}

/////////////////////////
//USAGE:
/////////////////////////
getAppIdByStreamAndAppName("STREAM-NAME...", "APP-NAME...").then(function(outAppId){ //E.g. getAppIdByStreamAndAppName("Economy-Stream", "Costs")

	//PUT YOUR CODE THAT NEEDS THE APP-ID HERE...

});

 

 

paulcalvet
Contributor

Re: App IDs and Object IDs change when deploying

Hello,

if you want to preserve the object id between your servers, you can add the objects (that you use in the mashup) to the master item.

Object id will never change in this case.

Paul

Community Browser