# Deep link questions

**URL:** https://forum.servoy.com/t/deep-link-questions/12320
**Category:** Classic Servoy
**Created:** [June 10, 2010, 5:14pm UTC](https://forum.servoy.com/t/deep-link-questions/12320 "2010-06-10T17:14:43Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [June 10, 2010, 5:14pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/1 "2010-06-10T17:14:43Z")

</div>

I’m trying to open a Servoy solution from FileMaker and pass a value to it to set a global variable. I’ve been told this is possible using a deeplink.

I’ve got a URL like this:

“172.18.72.xxx:8080/servoy-client/RIS\_archive.jnlp?m=start\_remote&a=bob|pw|P999990”

The behavior I want is for it to open a servoy window directly with no browser pop-up, and if it is already open, to simply update the IdPatient variable in Servoy with the P999990 string.

Now, if I open this URL from FM it simply opens a browser window and downloads the a file from the servoy app server; I have to manually click it. Furthermore, if the solution is already open, it doesn’t update the value, it simply refreshes with the initial value.

# I have tried this for the ‘start\_remote’ function in servoy:

# function start\_remote(user, password, patient\_id) { var sa\_args = application.getStartupArguments(); var sa\_seed = sa\_args[0]; var sa = utils.stringReplace(sa\_seed,“|”," "); var sa\_user = utils.stringLeftWords(sa,1); var sa\_pw = utils.stringMiddleWords(sa,2,1); var sa\_idpatient = utils.stringRightWords(sa,1); globals.IdPatient = sa\_idpatient; application.showForm(‘a0100\_\_Patient\_\_Appt\_nav’); }

Also, in the servoy-admin web console, I have set servoy.allowExistingClientActivate: to true.

Any help is appreciated!

---

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [June 10, 2010, 10:30pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/2 "2010-06-10T22:30:54Z")

</div>

OK, how about if I narrow the question more simply.

If I have a URL like this to open a smart client:

“172.18.72.241:8080/servoy-client/RIS\_archive.jnlp?m=start\_remote&a=user|pw|P999990”

and it is set to use an existing client, how do I access the NEW arguments instead of the startup arguments?

---

<div class="post-metadata">

### Author: ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)
#### Post date: [June 11, 2010, 4:21am UTC](https://forum.servoy.com/t/deep-link-questions/12320/3 "2010-06-11T04:21:47Z")

</div>

This behaviour is not supported in smartClient, please review: [http://forum.servoy.com/viewtopic.php?f=6&t=8295](http://forum.servoy.com/viewtopic.php?f=6&t=8295)

If you really need the smartclient for this, there might be a possibility to get a trigger via the solution databroadcast event.  
Maybe there’s even sort of a ‘file listener’ which can be set using plain java (don’t know if this exists in java)  
Anyone else can reply on this?

If you can use the webclient to run you solution however, there’s possibilities to reach your goal, please review: [http://forum.servoy.com/viewtopic.php?f=9&t=14208](http://forum.servoy.com/viewtopic.php?f=9&t=14208)

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [June 11, 2010, 7:29am UTC](https://forum.servoy.com/t/deep-link-questions/12320/4 "2010-06-11T07:29:35Z")

</div>

> This behaviour is not supported in smartClient, please review: [viewtopic.php?f=6&t=8295](http://forum.servoy.com/viewtopic.php?f=6&t=8295)

This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients. It will however always open a browser first, as that is the way to handle the url’s and trigger something at all. The way Servoy knows which client to activate is based on browser cookies, so the browser is needed for that as well: you cannot talk directly to the running Smart Client, it has to go through the Servoy Application Server.

Also, to make sure you do not get the second sessions, you need to start the first time from a URL that has x=x as parameter: The deeplinking into an existing Smart Client is partly based on cookies. When starting the Smart Client from, for example a desktop shortcut, while deeplink from within an email in a mail client, it can happen that the first deeplink from the mail client opens a new Smart Client anyway. A possible workaround for this is added ‘?x=x’ to the shortcut’s URL, like /servoy-client/mySolutionName.jnlp?x=x

> and it is set to use an existing client, how do I access the NEW arguments instead of the startup arguments?

In your example you’re calling the method “start\_remote”. the argument value you supply will be passed to that methods as arguments[0];

Paul

---

<div class="post-metadata">

### Author: ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)
#### Post date: [June 11, 2010, 8:07am UTC](https://forum.servoy.com/t/deep-link-questions/12320/5 "2010-06-11T08:07:51Z")

</div>

> pbakker:  
> This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients.

And what about when the browser doesn’t accept cookies?  
If this is the case ‘Allow Existing Client Activate = true’ won’t work either.  
As this is client side setting you’ll never know what the behaviour will be.

I agree, this might be theoretical, but can cause a serious issue if you assume it’ll always just work.

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [June 11, 2010, 8:11am UTC](https://forum.servoy.com/t/deep-link-questions/12320/6 "2010-06-11T08:11:28Z")

</div>

Yeah, then it pretty much stops…

---

<div class="post-metadata">

### Author: ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)
#### Post date: [June 11, 2010, 8:41am UTC](https://forum.servoy.com/t/deep-link-questions/12320/7 "2010-06-11T08:41:41Z")

</div>

Paul,

what about my suggestion to work with databroadcast triggering (could do this via altering a db value in a webclient)/ file listener trigger?

Do you have any experience on this?

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [June 11, 2010, 8:50am UTC](https://forum.servoy.com/t/deep-link-questions/12320/8 "2010-06-11T08:50:51Z")

</div>

Technically, that will work. It does mean starting another (web) client session, just to update the database.

Paul

---

<div class="post-metadata">

### Author: ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)
#### Post date: [June 11, 2010, 8:56am UTC](https://forum.servoy.com/t/deep-link-questions/12320/9 "2010-06-11T08:56:37Z")

</div>

> pbakker:  
> Technically, that will work. It does mean starting another (web) client session, just to update the database.

and file listener? Any java code in your cookbook? ![:wink:]( "Wink")  
This could avoid the extra session (which could be very short anyway, or even use the webservice plugin to alter the data)

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [June 11, 2010, 9:26am UTC](https://forum.servoy.com/t/deep-link-questions/12320/10 "2010-06-11T09:26:12Z")

</div>

If you’re into Java coding, then the best option I see if to create a server plugin that exposes a service that allows you to trigger a notifyDataChange to tell the server that data was edited. notifyDataChange is part of the public Java API (IServerAccess).

So, the “other” app inserts a record in a table, you make it call the service to tell the server an insert happened from outside Servoy and then in the Clients you listen to incoming databroadcasts: make sure you touch the table in that client, because the client will only receive databroadcasts for the tables that it’s using!

How to expose it as a service can be seen from the different plugins that already so so (for example the RESTful WS plugin).

I would create it in such a way that not everyone can just start calling that service to prevent a DoS attack.

Paul

---

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [June 14, 2010, 10:03pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/11 "2010-06-14T22:03:12Z")

</div>

> pbakker:
> 
> > This behaviour is not supported in smartClient, please review: [viewtopic.php?f=6&t=8295](http://forum.servoy.com/viewtopic.php?f=6&t=8295)
> 
> This is not 100% correct: If Allow Existing Client Activae is true, you can deeplink into existing clients. **It will however always open a browser first** , as that is the way to handle the url’s and trigger something at all. The way Servoy knows which client to activate is based on browser cookies, so the browser is needed for that as well: you cannot talk directly to the running Smart Client, it has to go through the Servoy Application Server.
> 
> Paul

OK, I am happy with this up to the point that it runs the method in the existing client, passes the parameters, etc., but it leaves the browser as the frontmost app, obscuring the servoy smart client window. How can I make the smart client end as the frontmost window? I’ve tried application.updateUI(), no joy.

Thanks for the help so far!

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [June 15, 2010, 8:15am UTC](https://forum.servoy.com/t/deep-link-questions/12320/12 "2010-06-15T08:15:48Z")

</div>

Don’t think operating systems allows applications to put themselves in front of others: that is up to the user.

Paul

---

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [June 15, 2010, 5:58pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/13 "2010-06-15T17:58:30Z")

</div>

> pbakker:  
> Don’t think operating systems allows applications to put themselves in front of others: that is up to the user.
> 
> Paul

Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Jim

---

<div class="post-metadata">

### Author: ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)
#### Post date: [June 15, 2010, 6:55pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/14 "2010-06-15T18:55:45Z")

</div>

> jmcneely:  
> Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.

Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:

```auto
var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')
application.executeProgram('osascript', '-e', 'tell application "System Events"',
	'-e', 'set theprocs to every process whose unix id is ' + PPID,
	'-e', 'repeat with proc in theprocs',
	'-e', 'set the frontmost of proc to true',
	'-e', 'end repeat', '-e', 'end tell')

```

---

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [June 15, 2010, 10:10pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/15 "2010-06-15T22:10:28Z")

</div>

> david:
> 
> > jmcneely:  
> > Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.
> 
> Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:
> 
> ```auto
> var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')
> 
> ```

application.executeProgram(‘osascript’, ‘-e’, ‘tell application “System Events”’,  
‘-e’, 'set theprocs to every process whose unix id is ’ + PPID,  
‘-e’, ‘repeat with proc in theprocs’,  
‘-e’, ‘set the frontmost of proc to true’,  
‘-e’, ‘end repeat’, ‘-e’, ‘end tell’)

> ```auto
> 
> ```

That worked!!! I owe you a beer or something. Do you drink beer? THANKS!!!

---

<div class="post-metadata">

### Author: ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)
#### Post date: [June 15, 2010, 10:20pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/16 "2010-06-15T22:20:23Z")

</div>

> jmcneely:  
> That worked!!! I owe you a beer or something. Do you drink beer? THANKS!!!

Cool, you’re welcome ![:)]( "Smile")

And this is how much I like beer…

[attachment=0]beer.jpg[/attachment]

 ![beer.jpg](https://canada1.discourse-cdn.com/flex010/uploads/servoy/original/2X/2/243ee650438feb163a26644ffe366873f9d89b2e.jpeg)

---

<div class="post-metadata">

### Author: ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)
#### Post date: [June 16, 2010, 7:47am UTC](https://forum.servoy.com/t/deep-link-questions/12320/17 "2010-06-16T07:47:53Z")

</div>

[St Feuillien](http://www.st-feuillien.com/FSTFeuillienENG.html) ![:D]( "Very Happy") My favorite (local) belgian beer (a couple of towns over from my place).

---

<div class="post-metadata">

### Author: ![david](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@david](https://forum.servoy.com/u/david)
#### Post date: [June 16, 2010, 3:57pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/18 "2010-06-16T15:57:14Z")

</div>

Lucky dude ![:)]( "Smile") We like the triple so much our local pub spent months trying to get that 9-liter delivered for us.

---

<div class="post-metadata">

### Author: ![joetraff](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@joetraff](https://forum.servoy.com/u/joetraff)
#### Post date: [July 14, 2010, 5:29pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/19 "2010-07-14T17:29:49Z")

</div>

> david:
> 
> > jmcneely:  
> > Then when they click the button, they end up with a blank browser window showing, with possibly a small hint of a servoy window peeking out from behind it. There simply has to be a better answer than this. I am trying having the script execute an Applescript to force the app to the front, but that is not proving to be so simple either. I’m open to ideas, but I can’t just leave it here.
> 
> Well if you’re just worried about Mac clients the following trickery should work if placed at the end of your deeplinked method:
> 
> ```auto
> var PPID = application.executeProgram('/bin/bash','-c', 'echo $PPID')
> 
> ```

application.executeProgram(‘osascript’, ‘-e’, ‘tell application “System Events”’,  
‘-e’, 'set theprocs to every process whose unix id is ’ + PPID,  
‘-e’, ‘repeat with proc in theprocs’,  
‘-e’, ‘set the frontmost of proc to true’,  
‘-e’, ‘end repeat’, ‘-e’, ‘end tell’)

> ```auto
> 
> ```

It worked just fine.  
Keep up the good work.

---

<div class="post-metadata">

### Author: ![jmcneely](https://avatars.discourse-cdn.com/v4/letter/j/6de8d8/32.png) [@jmcneely](https://forum.servoy.com/u/jmcneely)
#### Post date: [September 15, 2010, 5:18pm UTC](https://forum.servoy.com/t/deep-link-questions/12320/20 "2010-09-15T17:18:56Z")

</div>

David, you are way too funny! If we don’t run into each other at some conference or something I will need your address so I can MAIL you a beer.

[Next page](https://forum.servoy.com/t/deep-link-questions/12320.md?page=2)
