# application.getStartupArguments

**URL:** <https://forum.servoy.com/t/application-getstartuparguments/12231>\
**Category:** Classic Servoy\
**Created:** [May 25, 2010, 9:13am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231 "2010-05-25T09:13:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [May 25, 2010, 9:13am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/1 "2010-05-25T09:13:34Z")

</div>

Hi

I am not certain this function is working as described in the manual. As I understand it this function should return any arguments passed via the URL to a web client in the form of and array. I would therefore expect to get an array returned and be able to split this using the format array[0] for the first item etc

I have done a simple test site which can be accessed at the following address

[http://clipper.clickdigital.com/servoy- … est2|Test3](http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/Test1|Test2|Test3)

Note I would expect this code to return an item in each of the boxes using this function:

function startup2() {  
var args\_array = application.getStartupArguments();  
forms.login.Arg1 = args\_array[0];  
forms.login.Arg2 = args\_array[1];  
forms.login.Arg3 = args\_array[2];  
forms.login.arguments\_array = args\_array;  
forms.login.arguments\_array\_length = args\_array.length;  
}

ie that args\_array would now be an array

The results I am trying to obtain can be seen with this:

function startup1() {  
var args\_array = [‘Arg1’,‘Arg2’,‘Arg3’];  
forms.login.Arg1 = args\_array[0];  
forms.login.Arg2 = args\_array[1];  
forms.login.Arg3 = args\_array[2];  
forms.login.arguments\_array = args\_array;  
forms.login.arguments\_array\_length = args\_array.length;  
}

Having spent some time fiddling about with this any pointers to obvious errors would be appreciated

best  
gordon

---

<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:** [May 25, 2010, 10:29am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/2 "2010-05-25T10:29:32Z")

</div>

Hi Gordon,

if I’m not mistaken, the webclient gets the arguments as a string,  
the smart client however as an array.

So if your solution should handle both, you should test which client is being used.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [May 25, 2010, 10:36am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/3 "2010-05-25T10:36:28Z")

</div>

Hi Marc

Although strange that makes sense based on the response I am getting from the web client. The docs suggest its all passed as an array and I would wonder why Servoy would have changed the approach - array seems a lot easier for all concerned !!

Thanks for the reply

best  
Gordon

---

<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:** [May 25, 2010, 11:15am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/4 "2010-05-25T11:15:29Z")

</div>

We’ve been using both web and smart client since v3.5. It’s always been like this.  
It will be very unlikely to change.

Anyway, if you just pass your arguments with a separator you know (I believe you now use ‘|’), your code can look something like this:

```auto
function startup1()
{
var args_array = ('' + application.getStartupArguments()).split('|');
forms.login.Arg1 = args_array[0]
etc.
etc.
}

```

---

<div class="post-metadata">

**Author:** ![Gabi\_Boros](https://avatars.discourse-cdn.com/v4/letter/g/73ab20/32.png) [@Gabi\_Boros](https://forum.servoy.com/u/Gabi_Boros)\
**Post date:** [May 31, 2010, 10:16am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/5 "2010-05-31T10:16:15Z")

</div>

starting from version 5, getStartupArguments can return null,  
if no arguments are used, or an array with 2 elements : the first  
element is the value of the ‘argument’ used in the startup link,  
and the second element is a javascript object containing all the  
startup arguments identified by names

in case of your url:  
‘[http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/Test1|Test2|Test3](http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/Test1%7CTest2%7CTest3)’  
var startup\_args = application.getStartupArguments();  
var argument = startup\_args[0]; // it is ‘Test1|Test2|Test3’  
var starup\_args\_object = startup\_args[1]; // startup\_args\_object.a is also ‘Test1|Test2|Test3’

you can pass multiple named arguments using an url of this form:  
‘[http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/defaultArgumentValue/argName1/argValue1/argName2/argValue2](http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/defaultArgumentValue/argName1/argValue1/argName2/argValue2)’  
var startup\_args = application.getStartupArguments();  
var argument = startup\_args[0]; // it is ‘defaultArgumentValue’  
var starup\_args\_object = startup\_args[1]; // startup\_args\_object.a is also ‘defaultArgumentValue’, startup\_args\_object.argName1 is ‘argValue1’, startup\_args\_object.argName2 is ‘argValue2’

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [June 3, 2010, 12:25pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/6 "2010-06-03T12:25:55Z")

</div>

Hi Gabi

Thanks for this - it makes sense and explains the object in argument 2 that was being returned

This whole revisit of the arguments started with the intention of using Servoy to listen for IPN returns from Paypal. They send a string in the form [Pay, Send and Save Money with PayPal | PayPal US](http://paypal.com?arg=x&etc) - I concluded that it was therefore not possible to get Servoy to listen for this response and have instead used a PHP listner and had it pass the details to Servoy as it prefers ie your suggested format.

Best  
Gordon

---

<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 3, 2010, 1:11pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/7 "2010-06-03T13:11:45Z")

</div>

Please note:

using application.getStartupArguments() do not always return the correct arguments.  
This occurs whenever you have an active session already.  
for Mac users this is real easy as Safari doesn’t close by default, windows users experience this for example clicking a 2nd link when there’s already a webclient connected in another tab of your browser.

Anyway when using something like this: ‘[http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/Test1|Test2|Test3](http://clipper.clickdigital.com/servoy-webclient/ss/s/TestArgs/m/startup2/a/Test1%7CTest2%7CTest3)’

You’d better ask for the arguments like this:  
var startup\_args = arguments;

This way you always get the correct arguments into your var.  
This ONLY works when having a method specified in the link (‘/m/startup2/’)

All credits to Paul Bakker who helped me out on this yesterday.

---

<div class="post-metadata">

**Author:** ![Marco\_R](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Marco\_R](https://forum.servoy.com/u/Marco_R)\
**Post date:** [October 15, 2010, 4:42pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/8 "2010-10-15T16:42:24Z")

</div>

Hi all,

I would to pass a number as argument and following the Marc example I’ve tried with:

“[http://localhost:9090/servoy-webclient/solutions/solution/file\_solution|877](http://localhost:9090/servoy-webclient/solutions/solution/file_solution%7C877)”

and with:

“[http://localhost:9090/servoy-webclient/solutions/solution/file\_solution?var1=877](http://localhost:9090/servoy-webclient/solutions/solution/file_solution?var1=877)”

but without result.

Can you tell me the correct way to pass an argument to a servoy web application?

thanks in advace

Marco

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [October 15, 2010, 5:52pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/9 "2010-10-15T17:52:28Z")

</div>

> Marco R.:  
> “[http://localhost:9090/servoy-webclient/solutions/solution/file\_solution|877](http://localhost:9090/servoy-webclient/solutions/solution/file_solution%7C877)”

You might like to try this

“[http://localhost:9090/servoy-webclient/ss/s/file\_solution/m/yourstartupmethod/a/877](http://localhost:9090/servoy-webclient/ss/s/file_solution/m/yourstartupmethod/a/877)”

ss/s are a shortcut for solutions/solution that makes the URL easier to read  
a = arguments ? wont work with Servoy  
m = the method that receives the arguments and this needs to be a global

HTH  
Gordon

---

<div class="post-metadata">

**Author:** ![Marco\_R](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@Marco\_R](https://forum.servoy.com/u/Marco_R)\
**Post date:** [October 16, 2010, 2:07pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/10 "2010-10-16T14:07:25Z")

</div>

Clear gordon.

Thanks for your time ![:)]( "Smile")

Marco

---

<div class="post-metadata">

**Author:** ![tysonj](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@tysonj](https://forum.servoy.com/u/tysonj)\
**Post date:** [September 27, 2011, 11:41am UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/11 "2011-09-27T11:41:03Z")

</div>

Hi,

When I am trying to call a global method in my Web Solution using the below URL the argument I send to the function is not received by the method.  
example of URL :- “[http://localhost:8080/servoy-webclient/solutions/solution/MySolution/method/SomeMethod/arguments/001](http://localhost:8080/servoy-webclient/solutions/solution/MySolution/method/SomeMethod/arguments/001)”

the function defination :-  
/\*\*

- @param {String} arg
- 
- @properties={typeid:24,uuid:“BAF06510-68E4-4A2D-8D56-803F4FE0CA66”}  
\*/  
function SomeMethod(arg)  
{  
application.output('Success :- '+ arg);  
}

but arguments was not received by the global method in the solution. It was displaying the message as Success :- undefined.  
I don’t know were am going wrong please help me out…???

---

<div class="post-metadata">

**Author:** ![tysonj](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@tysonj](https://forum.servoy.com/u/tysonj)\
**Post date:** [September 28, 2011, 12:12pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/12 "2011-09-28T12:12:12Z")

</div>

Found the answer for the above… ![:)]( "Smile")  
used argument instead of arguments in the URL to pass the parameter.

---

<div class="post-metadata">

**Author:** ![Gordon](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@Gordon](https://forum.servoy.com/u/Gordon)\
**Post date:** [September 28, 2011, 12:17pm UTC](https://forum.servoy.com/t/application-getstartuparguments/12231/13 "2011-09-28T12:17:27Z")

</div>

The short version of of the URL makes this a lot easier i.e. the ss/s and m and a - especially in my case where I am dreadful at spelling ![:roll:]( "Rolling Eyes")

“[http://localhost:9090/servoy-webclient/ss/s/file\_solution/m/yourstartupmethod/a/877](http://localhost:9090/servoy-webclient/ss/s/file_solution/m/yourstartupmethod/a/877)”
