View Full Version : Passing parameter to Cloud App

2017-11-02, 17:25
I thought I read something about this and can't find it.

What I want to do is make a call like this from a browser (or link):


and pick it up in the INIT of the app, where I will then do things with it before anything else happens in the app.

The app would be set to public access, so the login screen would not appear. The querystring would be used for validation and other purposes.

I tried using:

$_SERVER["querystring"] in the INIT of the app without success. The code that checked for $_SERVER being defined and not null skipped right around the Lianja.showMessage I was using to test.



2017-11-02, 20:32
Hi Hank

$_SERVER is a server side array. It cannot be accessed in the client.

if you need to access the uri which was called to run the app from inside the app itself in the client you should access the uri from the ready delegate on the client.

if (typeof LianjaAppBuilder !== Ďundefinedí) return; // ignore in dev mode
var url = window.location.href;
// now extract the args and do as you will with them

2017-11-02, 20:35
Hi hank

One other solution would be to add a server side delegate that gets called when an app is run e.g call a validaterequest.prg if it exists in the app directory.

2017-11-02, 20:56
Hi Barry,


Is there any way to retrieve the _server.query_string from the server? The idea is to be able to pass a parameter to an app.

The Use Case is the user clicks a button in an email with a magic token as the query_string and goes directly into what is actually a Lianja App but looks like a fancy web page -- and of course is responsive so can run on mobile.



2017-11-02, 23:50
Hi Hank,

In your ready delegate you have that information available to you:

var query_string = "";
var href = window.location.href;
var pos = href.indexOf("?");
if (pos > 0) query_string = href.substring(pos+1);
var argv = query_string.split("&");
for (var i=0; i<argv.length; ++i)
arg = argv[i].split("=");
argname = arg[0];
argvalue = arg[1];

2017-11-03, 09:45
Wonderful! That does the trick. If you hadn't had a chance to respond, I was going to follow up on window.location to see what else was there, but I was tied up for the evening.

I said many kind and true things about you tonight to a couple friends/developers. I hope you noticed. :) We're in the process of forming a cooperative of small shops of data experts, like us, and meet weekly on Zoom.



2017-11-03, 13:30
Glad itís useful :)