Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have a website with an inner Qlik iframe that points to a specific app sheet. We want from outside the iframe programmatically create a bookmark from the selection that the user have done inside the Qlik iframe.
We know which user that is logged into the iframe, we know the app, sheet and we know the sessionid.
Do anyone know how to programmatically create a bookmark (with the selection) with either the Qlik SDK or the REST endpoints (qrs, qps)?
In the theory, if you are connecting as the same user inside and outside the iFrame, the Engine session will be shared and selections applied in the iFrame will already be taken into consideration.
Then all you need to do outside the iFrame to create the bookmark would be to call the API to create a bookmark:
https://help.qlik.com/en-US/sense-developer/February2021/Subsystems/APIs/Content/Sense_ClientAPIs/Ca...
Yes, that is what we are trying to do (bcqlikuser is my colleague), but we have a problem getting the app instance. When we try location.ActiveApp it terminates the ongoing session in the client.
I have also tried
var session = Session.WithApp(appIdentifier, SessionType.Default)
but how do you get the app instance out of this, to be able to call CreateGenericBookmark?
I am not too familiar on how you would do it with the .NET SDK, but if you were to use the capability API, it would be something like this:
HTML page:
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Qlik Sense Mashup</title>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="cleartype" content="on">
<link rel="stylesheet" href="../../resources/autogenerated/qlik-styles.css">
<link rel="stylesheet" href="bookmarkandiFrame.css">
<script src="../../resources/assets/external/requirejs/require.js"></script>
<script src="bookmarkandiFrame.js"></script>
</head>
<body style="overflow: auto">
<div class="flex-container">
<div><button id="button1">Create Bookmark</button></div>
<div id="QV02" class="qvplaceholder"><iframe src='https://qlikserver1.domain.local/single/?appid=e56f3f82-ddfe-4229-9ace-4c514c689ff4&sheet=0bf9ccba-7749-46fc-8aba-699e001b6c14' style='border:none;width:100%;height:100%;'></iframe></div>
</div>
<!--Error Popup-->
<div id="popup">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" id="closePopup"><span aria-hidden="true">×</span></button>
<p id="popupText"></p>
</div>
</body>
</html>
Javascript (bookmarkandiFrame.js)
/*
* Basic responsive mashup template
* @owner Enter you name here (xxx)
*/
/*
* Fill in host and port for Qlik engine
*/
var prefix = window.location.pathname.substr( 0, window.location.pathname.toLowerCase().lastIndexOf( "/extensions" ) + 1 );
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config( {
baseUrl: ( config.isSecure ? "https://" : "http://" ) + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
} );
require( ["js/qlik"], function ( qlik ) {
qlik.on( "error", function ( error ) {
$( '#popupText' ).append( error.message + "<br>" );
$( '#popup' ).fadeIn( 1000 );
} );
$( "#closePopup" ).click( function () {
$( '#popup' ).hide();
} );
//callbacks -- inserted here --
//open apps -- inserted here --
var app = qlik.openApp('e56f3f82-ddfe-4229-9ace-4c514c689ff4',config);
$( "#button1" ).on( 'click', function () {
app.bookmark.create('Test','Test bookmark');
} );
} );
Please also make sure that "Extended Security Environment" is disabled in the virtual proxy settings in the QMC as that would forbid session sharing.
Hello everyone,
Correct me if I'm wrong, please. This bookmark creation will only work if I use Qlik Sense iFrames, won't it? On the contrary, if I use the Qlik Analytics Platform, I would not be able to do so, would I? Because it does not use licenses whatsoever and the users are anonymous.
Thanks in advance!