# Application

(application)

## Overview

The `application` class is a core utility in Servoy, enabling robust management of client sessions, user interfaces, and interactions with the underlying system. It provides functionality to control solutions, interact with system resources, and manage both client-specific and server-side behaviors.

One of its primary capabilities is the management of solutions. Developers can close and optionally reopen solutions dynamically, ensuring that applications adapt to user or system requirements without disruption. The `application` object also facilitates the creation and handling of windows and dialogs, allowing for advanced UI management. Developers can create custom windows, retrieve active ones, and manipulate UI elements to provide tailored user experiences.

The `application` object also provides tools to interact with the underlying system. It enables developers to execute external programs, both synchronously and asynchronously, gather system information such as client IP addresses and operating systems, and work with clipboard data. Additionally, it allows for managing properties at both the user and client levels, offering persistent and configurable settings across sessions.

Advanced logging and debugging capabilities are integrated into the `application` class, allowing developers to assert conditions, log messages at varying levels, and gain insights into application behavior. Furthermore, it offers support for value lists and dynamic data management, enabling seamless integration with forms and data models.

Several core methods highlight its versatility. Functions like `closeSolution` and `createWindow` exemplify its solution and UI management features. System-level utilities like `executeProgram`, `getHostName`, and `getOSName` extend its reach to the operating environment. Persistent storage and customization are supported through methods like `getUserProperty` and `setUserProperty`, while utilities such as `addClientInfo` and `refreshGlobalMethodValueList` provide dynamic adaptability for client-specific needs.

## **Returned Types**

[APPLICATION\_TYPES](/reference/servoycore/dev-api/application/application_types.md),[CLIENTDESIGN](/reference/servoycore/dev-api/application/clientdesign.md),[ELEMENT\_TYPES](/reference/servoycore/dev-api/application/element_types.md),[CSSPosition](/reference/servoycore/dev-api/application/cssposition.md),[JSDimension](/reference/servoycore/dev-api/application/jsdimension.md),[JSPoint](/reference/servoycore/dev-api/application/jspoint.md),[JSBounds](/reference/servoycore/dev-api/application/jsbounds.md),[JSDNDEvent](/reference/servoycore/dev-api/application/jsdndevent.md),[JSEvent](/reference/servoycore/dev-api/application/jsevent.md),[JSRenderEvent](https://github.com/Servoy/gitbook/blob/master/reference/servoycore/dev-api/application/jsrenderevent.md),[JSUpload](/reference/servoycore/dev-api/application/jsupload.md),[JSWindow](/reference/servoycore/dev-api/application/jswindow.md),[JSLogger](/reference/servoycore/dev-api/application/jslogger.md),[JSLogBuilder](/reference/servoycore/dev-api/application/jslogbuilder.md),[LOGGINGLEVEL](/reference/servoycore/dev-api/application/logginglevel.md),[UICONSTANTS](/reference/servoycore/dev-api/application/uiconstants.md),[UUID](/reference/servoycore/dev-api/application/uuid.md),[NGCONSTANTS](/reference/servoycore/dev-api/application/ngconstants.md),

## Methods Summarized

| Type                                                                     | Name                                                                                                                                          | Summary                                                                                                                                                                                                 |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| void                                                                     | [addClientInfo(info)](#addclientinfo-info)                                                                                                    | Adds a string of client information which gets stored on the server, and can be viewed on the Clients page of Servoy Server Administration Console.                                                     |
| void                                                                     | [assert(condition, message)](#assert-condition-message)                                                                                       | This assert method can be used to check for conditions in the code.                                                                                                                                     |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [closeAllWindows()](#closeallwindows)                                                                                                         | Close all visible windows (except main application window).                                                                                                                                             |
| void                                                                     | [closeSolution()](#closesolution)                                                                                                             | Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.                                                               |
| void                                                                     | [closeSolution(solutionToLoad)](#closesolution-solutiontoload)                                                                                | Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.                                                               |
| void                                                                     | [closeSolution(solutionToLoad, methodArgument)](#closesolution-solutiontoload-methodargument)                                                 | Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.                                                               |
| void                                                                     | [closeSolution(solutionToLoad, methodName)](#closesolution-solutiontoload-methodname)                                                         | Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.                                                               |
| void                                                                     | [closeSolution(solutionToLoad, methodName, methodArgument)](#closesolution-solutiontoload-methodname-methodargument)                          | Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.                                                               |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [createNewFormInstance(designFormName, newInstanceScriptName)](#createnewforminstance-designformname-newinstancescriptname)                   | Create a new form instance.                                                                                                                                                                             |
| [JSWindow](/reference/servoycore/dev-api/application/jswindow.md)        | [createWindow(windowName, type)](#createwindow-windowname-type)                                                                               | Creates a new window that can be used for displaying forms.                                                                                                                                             |
| [JSWindow](/reference/servoycore/dev-api/application/jswindow.md)        | [createWindow(windowName, type, parentWindow)](#createwindow-windowname-type-parentwindow)                                                    | Creates a new window that can be used for displaying forms.                                                                                                                                             |
| void                                                                     | [executeLater(function, delay)](#executelater-function-delay)                                                                                 | Runs at method at the given delay in milliseconds.                                                                                                                                                      |
| void                                                                     | [executeLater(function, delay, arguments)](#executelater-function-delay-arguments)                                                            | Runs at method at the given delay in milliseconds with the arguments given to the method.                                                                                                               |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [executeProgram(program)](#executeprogram-program)                                                                                            | Execute a program and returns output.                                                                                                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [executeProgram(program, params)](#executeprogram-program-params)                                                                             | Execute a program and returns output.                                                                                                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [executeProgram(program, params, environmentVars)](#executeprogram-program-params-environmentvars)                                            | Execute a program and returns output.                                                                                                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [executeProgram(program, params, environmentVars, startDir)](#executeprogram-program-params-environmentvars-startdir)                         | Execute a program and returns output.                                                                                                                                                                   |
| void                                                                     | [executeProgramInBackground(program)](#executeprograminbackground-program)                                                                    | Execute a program in the background.                                                                                                                                                                    |
| void                                                                     | [executeProgramInBackground(program, params)](#executeprograminbackground-program-params)                                                     | Execute a program in the background.                                                                                                                                                                    |
| void                                                                     | [executeProgramInBackground(program, params, environmentVars)](#executeprograminbackground-program-params-environmentvars)                    | Execute a program in the background.                                                                                                                                                                    |
| void                                                                     | [executeProgramInBackground(program, params, environmentVars, startDir)](#executeprograminbackground-program-params-environmentvars-startdir) | Execute a program in the background.                                                                                                                                                                    |
| void                                                                     | [exit()](#exit)                                                                                                                               | Stop and exit application.                                                                                                                                                                              |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getActiveClientCount(currentSolutionOnly)](#getactiveclientcount-currentsolutiononly)                                                        | Get the active user count on the server (can be limited to current solution).                                                                                                                           |
| [JSWindow](/reference/servoycore/dev-api/application/jswindow.md)        | [getActiveWindow()](#getactivewindow)                                                                                                         | This gets the currently focused active window; this can be the main application window or a modal dialog.                                                                                               |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getApplicationType()](#getapplicationtype)                                                                                                   | Get the application type.                                                                                                                                                                               |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getClientCountForInfo(info)](#getclientcountforinfo-info)                                                                                    | Gets the count for all clients displaying the same additional information in the Clients page of Servoy Server Administration Console.                                                                  |
| [Object](/reference/servoycore/dev-api/js-lib/object.md)                 | [getClientProperty(name)](#getclientproperty-name)                                                                                            | Sets a UI property as a global value.                                                                                                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getClipboardString()](#getclipboardstring)                                                                                                   | Gets a string from the clipboard, null if not a string or empty.                                                                                                                                        |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getHostName()](#gethostname)                                                                                                                 | Get the name of the localhost.                                                                                                                                                                          |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getIPAddress()](#getipaddress)                                                                                                               | Get the clients' IP address.                                                                                                                                                                            |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getLicenseNames()](#getlicensenames)                                                                                                         | Get the names of the used client licenses (as strings in array).                                                                                                                                        |
| [JSLogger](/reference/servoycore/dev-api/application/jslogger.md)        | [getLogger()](#getlogger)                                                                                                                     | Get a JSLogger instance which offers an API for logging with arguments.                                                                                                                                 |
| [JSLogger](/reference/servoycore/dev-api/application/jslogger.md)        | [getLogger(loggerName)](#getlogger-loggername)                                                                                                | Get a JSLogger instance which offers an API for logging with arguments.                                                                                                                                 |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getOSName()](#getosname)                                                                                                                     | Returns the name of the operating system of the client.                                                                                                                                                 |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getScreenHeight()](#getscreenheight)                                                                                                         | Get the screen height in pixels.                                                                                                                                                                        |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getScreenWidth()](#getscreenwidth)                                                                                                           | Get the screen width in pixels.                                                                                                                                                                         |
| [Date](/reference/servoycore/dev-api/js-lib/date.md)                     | [getServerTimeStamp()](#getservertimestamp)                                                                                                   | Returns a date object initialized on server with current date and time.                                                                                                                                 |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getServerURL()](#getserverurl)                                                                                                               | Gets the HTTP server url.                                                                                                                                                                               |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getServerUUID()](#getserveruuid)                                                                                                             | Get the uuid from this server instance (the same value that is shown on the admin page)                                                                                                                 |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getServoyProperty(name)](#getservoyproperty-name)                                                                                            | Get a persistent property value (from servoy.                                                                                                                                                           |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getServoyPropertyNames()](#getservoypropertynames)                                                                                           | Get all persistent property names (from servoy.                                                                                                                                                         |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getSolutionName()](#getsolutionname)                                                                                                         | Returns the name of the current solution.                                                                                                                                                               |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)                 | [getSolutionRelease()](#getsolutionrelease)                                                                                                   | Get the solution release number.                                                                                                                                                                        |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getStartupArguments()](#getstartuparguments)                                                                                                 | Get the parameters which are provided by startup.                                                                                                                                                       |
| [Date](/reference/servoycore/dev-api/js-lib/date.md)                     | [getTimeStamp()](#gettimestamp)                                                                                                               | Returns a date object initialized in client with current date and time.                                                                                                                                 |
| [UUID](/reference/servoycore/dev-api/application/uuid.md)                | [getUUID()](#getuuid)                                                                                                                         | Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object.                                                                               |
| [UUID](/reference/servoycore/dev-api/application/uuid.md)                | [getUUID(byteArray)](#getuuid-bytearray)                                                                                                      | Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object.                                                                               |
| [UUID](/reference/servoycore/dev-api/application/uuid.md)                | [getUUID(uuidString)](#getuuid-uuidstring)                                                                                                    | Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object.                                                                               |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getUserProperty(name)](#getuserproperty-name)                                                                                                | Get a persistent user property.                                                                                                                                                                         |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getUserPropertyNames()](#getuserpropertynames)                                                                                               | Get all persistent user property names.                                                                                                                                                                 |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getValueListArray(name)](#getvaluelistarray-name)                                                                                            | Retrieve a valuelist as array, to get real-values for display-values.                                                                                                                                   |
| [Object](/reference/servoycore/dev-api/js-lib/object.md)                 | [getValueListDisplayValue(name, realValue)](#getvaluelistdisplayvalue-name-realvalue)                                                         | Retrieve a valuelist display-value for a real-value.                                                                                                                                                    |
| [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) | [getValueListItems(name)](#getvaluelistitems-name)                                                                                            | Get all values from a custom or database type value list as dataset (with columns displayValue,realValue).                                                                                              |
| [Array](/reference/servoycore/dev-api/js-lib/array.md)                   | [getValueListNames()](#getvaluelistnames)                                                                                                     | Get all the valuelist names as array.                                                                                                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)                 | [getVersion()](#getversion)                                                                                                                   | Returns the application version.                                                                                                                                                                        |
| [Object](/reference/servoycore/dev-api/js-lib/object.md)                 | [getVersionInfo()](#getversioninfo)                                                                                                           | Get the full version information of this solution and all its modules.                                                                                                                                  |
| [JSWindow](/reference/servoycore/dev-api/application/jswindow.md)        | [getWindow()](#getwindow)                                                                                                                     | Get the main application window.                                                                                                                                                                        |
| [JSWindow](/reference/servoycore/dev-api/application/jswindow.md)        | [getWindow(name)](#getwindow-name)                                                                                                            | Get a window by window name.                                                                                                                                                                            |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [isInDeveloper()](#isindeveloper)                                                                                                             | Returns true if the solution is running in the developer.                                                                                                                                               |
| void                                                                     | [output(msg)](#output-msg)                                                                                                                    | Output something on the out stream.                                                                                                                                                                     |
| void                                                                     | [output(msg, level)](#output-msg-level)                                                                                                       | Output something on the out stream.                                                                                                                                                                     |
| void                                                                     | [overrideStyle(originalStyleName, newStyleName)](#overridestyle-originalstylename-newstylename)                                               | It overrides the original stylesheet media defined on a solution with another media.                                                                                                                    |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [putClientProperty(name, value)](#putclientproperty-name-value)                                                                               | Sets a UI property as a global value.                                                                                                                                                                   |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [refreshGlobalMethodValueList(element)](#refreshglobalmethodvaluelist-element)                                                                | Refresh a global method valuelist by forcing it to call the global method.                                                                                                                              |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [refreshGlobalMethodValueList(element, propertyName)](#refreshglobalmethodvaluelist-element-propertyname)                                     | Refresh a global method valuelist by forcing it to call the global method.                                                                                                                              |
| void                                                                     | [removeAllClientInfo()](#removeallclientinfo)                                                                                                 | Removes all names given to the client via the admin page.                                                                                                                                               |
| void                                                                     | [removeAllUserProperties()](#removealluserproperties)                                                                                         | Removes all user properties.                                                                                                                                                                            |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [removeClientInfo(info)](#removeclientinfo-info)                                                                                              | Removes a string of client information which is stored on the server and previously was added using the application.                                                                                    |
| void                                                                     | [removeUserProperty(name)](#removeuserproperty-name)                                                                                          | Removes a user property.                                                                                                                                                                                |
| void                                                                     | [setClipboardContent(string)](#setclipboardcontent-string)                                                                                    | Sets a string object in the clipboard.                                                                                                                                                                  |
| void                                                                     | [setUserProperty(name, value)](#setuserproperty-name-value)                                                                                   | Sets a user property for this client: In NGClient/Titanium Client this is stored in the locale storage of the browser, so it will be persisted over restarts as long as the user didn't clear the data. |
| void                                                                     | [setValueListItems(name, dataset)](#setvaluelistitems-name-dataset)                                                                           | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [setValueListItems(name, dataset, autoconvert)](#setvaluelistitems-name-dataset-autoconvert)                                                  | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [setValueListItems(name, displayValues)](#setvaluelistitems-name-displayvalues)                                                               | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [setValueListItems(name, displayValues, autoconvert)](#setvaluelistitems-name-displayvalues-autoconvert)                                      | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [setValueListItems(name, displayValues, realValues)](#setvaluelistitems-name-displayvalues-realvalues)                                        | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [setValueListItems(name, displayValues, realValues, autoconvert)](#setvaluelistitems-name-displayvalues-realvalues-autoconvert)               | Fill a custom type valuelist with values from array(s) or dataset.                                                                                                                                      |
| void                                                                     | [showForm(form)](#showform-form)                                                                                                              | Show the form specified by the parameter, that can be a name (is case sensitive!) or a form object.                                                                                                     |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [showURL(url)](#showurl-url)                                                                                                                  | Shows an URL in a browser.                                                                                                                                                                              |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [showURL(url, browserTarget)](#showurl-url-browsertarget)                                                                                     | Shows an URL in a browser.                                                                                                                                                                              |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [showURL(url, browserTarget, timeout)](#showurl-url-browsertarget-timeout)                                                                    | Shows an URL in a browser.                                                                                                                                                                              |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [showURL(url, browserTarget, browserTargetOptions)](#showurl-url-browsertarget-browsertargetoptions)                                          | Shows an URL in a browser.                                                                                                                                                                              |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)               | [showURL(url, browserTarget, browserTargetOptions, timeout)](#showurl-url-browsertarget-browsertargetoptions-timeout)                         | Shows an URL in a browser.                                                                                                                                                                              |
| void                                                                     | [sleep(ms)](#sleep-ms)                                                                                                                        | Sleep for specified time (in milliseconds).                                                                                                                                                             |
| void                                                                     | [updateUI()](#updateui)                                                                                                                       | Updates the UI (painting).                                                                                                                                                                              |
| void                                                                     | [updateUI(milliseconds)](#updateui-milliseconds)                                                                                              | Updates the UI (painting).                                                                                                                                                                              |

## Methods Detailed

### addClientInfo(info)

Adds a string of client information which gets stored on the server, and can be viewed on the Clients page of Servoy Server Administration Console. The new piece of client information is added on behalf of the running Servoy client. This function can be called more than once, if you want to add multiple lines of client information. NOTE: This function can also be used with the function \<em>getClientCountForInfo\</em> to count the number of clients with matching addditional client information.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **info** A line of text to be added as additional client information\
  on behalf of the running Servoy client.

**Returns:** void

**Sample**

```js
application.addClientInfo('SaaS company name');
application.addClientInfo('For any issues call +31-SA-AS');
```

### assert(condition, message)

This assert method can be used to check for conditions in the code.\
A message can be give that will then end up in the log file (with the stacktrace where this failed).

If the condition is false and your are in developer then also the debugger will stop on this line by default.

**Parameters**

* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **condition** If false then the assert is wrong and the message will be printed, debugger will stop on this line.
* [String](/reference/servoycore/dev-api/js-lib/string.md) **message** The message to display if the condition is false.

**Returns:** void

**Sample**

```js
application.assert(userId != null, "User id should not be null");
```

### closeAllWindows()

Close all visible windows (except main application window). Returns true if operation was successful.

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean true if all windows were closed and false otherwise.

**Sample**

```js
var win = application.createWindow("aWindowName", JSWindow.DIALOG, null);
win.setInitialBounds(10, 10, 300, 300);
win.title = "This is a window";
controller.show(win);

var win2 = application.createWindow("anotherWindowName", JSWindow.DIALOG, null);
win2.setInitialBounds(100, 100, 300, 300);
win2.title = "This is another window";
controller.show(win2);

var qdialog = plugins.dialogs.showQuestionDialog("QuestionDialog","Do you want to close the windows?","Yes","No");
if (qdialog == "Yes") {
	application.closeAllWindows();
	controller.show(null);
}
```

### closeSolution()

Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.\
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.\
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).\
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).

**Returns:** void

**Sample**

```js
//application.showURL('http://www.servoy.com', '_self');
application.closeSolution();
//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in
//application.closeSolution('solution_name','global_method_name','my_argument');
//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific type )
```

### closeSolution(solutionToLoad)

Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.\
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.\
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).\
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **solutionToLoad** Name of the solution to load

**Returns:** void

**Sample**

```js
//application.showURL('http://www.servoy.com', '_self');
application.closeSolution();
//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in
//application.closeSolution('solution_name','global_method_name','my_argument');
//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific type )
```

### closeSolution(solutionToLoad, methodArgument)

Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.\
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.\
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).\
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **solutionToLoad** Name of the solution to load
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **methodArgument** Argument passed to the solution onOpen

**Returns:** void

**Sample**

```js
//application.showURL('http://www.servoy.com', '_self');
application.closeSolution();
//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in
//application.closeSolution('solution_name','global_method_name','my_argument');
//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific type )
```

### closeSolution(solutionToLoad, methodName)

Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.\
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.\
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).\
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **solutionToLoad** Name of the solution to load
* [String](/reference/servoycore/dev-api/js-lib/string.md) **methodName** Name of the global method to call

**Returns:** void

**Sample**

```js
//application.showURL('http://www.servoy.com', '_self');
application.closeSolution();
//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in
//application.closeSolution('solution_name','global_method_name','my_argument');
//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific type )
```

### closeSolution(solutionToLoad, methodName, methodArgument)

Closes the currently open solution and optionally opens another solution, calling a specified global method with the specified arguments.\
If the user has been logged in, this function keeps the user logged in and in the newly open solution, the login is skipped and the solution goes straight to the first form.\
If you want to go to a different url, you need to call application.showURL(url) before calling application.closeSolution() (this is only applicable for Web Client).\
An alternative option is security.logout() which also does a log out for the user (for solutions that require authentication).

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **solutionToLoad** Name of the solution to load
* [String](/reference/servoycore/dev-api/js-lib/string.md) **methodName** Name of the global method to call
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **methodArgument** Argument passed to the global method

**Returns:** void

**Sample**

```js
//application.showURL('http://www.servoy.com', '_self');
application.closeSolution();
//close current solution, open solution 'solution_name', call global method 'global_method_name' with argument 'my_argument'.
//if the user has been logged in, he will stay logged in
//application.closeSolution('solution_name','global_method_name','my_argument');
//application.closeSolution('solution_name', {a: 'my_string_argument', p1: 'param1', p2: 'param2'});//close current solution, open solution 'solution_name', call solution's onOpen with argument 'my_argument' and queryParams p1,p2
//Note: specifying a solution will not work in the Developer due to debugger dependencies
//specified solution should be of compatible type with client (normal type or client specific type )
```

### createNewFormInstance(designFormName, newInstanceScriptName)

Create a new form instance.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **designFormName** Name of the design form
* [String](/reference/servoycore/dev-api/js-lib/string.md) **newInstanceScriptName** Name of the new form instance

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if the instance was created succesfully, (false) otherwise

**Sample**

```js
var ok = application.createNewFormInstance('orders','orders_view');
if (ok)
{
	var dialog = application.createWindow("myDialog", JSWindow.DIALOG);
 dialog.show('orders_view')
	//forms['orders_view'].controller.show()
	//forms.xyz.elements.myTabPanel.addTab(forms['orders_view'])
	//forms['orders_view'].elements.mylabel.setLocation(10,20)
}
```

### createWindow(windowName, type)

Creates a new window that can be used for displaying forms. Initially the window is not visible.\
If there is already a window with the given name, it will be closed and destroyed prior to creating the new window.\
Use the form controller show() and showRecords() methods in order to show a form in this window.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **windowName** the name of the window. Should not be null.
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **type** the type of the window. Can be one of JSWindow\.DIALOG, JSWindow\.MODAL\_DIALOG, JSWindow\.WINDOW. (WINDOW does not work for NGClient)

**Returns:** [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) the newly created window.

**Sample**

```js
// create and show a window, with specified title, initial location and size
// type of the window can be one of JSWindow.DIALOG, JSWindow.MODAL_DIALOG, JSWindow.WINDOW (WINDOW does not work for NGClient)
// If parentWindow is not specified, the current window will be used as parent; parentWindow parameter is only used by dialogs
var win = application.createWindow("windowName", JSWindow.DIALOG);
win.setInitialBounds(10, 10, 300, 300);
win.title = "This is a window";
controller.show(win);
// create and show a non-modal dialog with default initial bounds/title
var nmd = application.createWindow("nonModalDialogName", JSWindow.DIALOG);
controller.showRecords(15, nmd); // 15 is a single-number pk in this case
```

### createWindow(windowName, type, parentWindow)

Creates a new window that can be used for displaying forms. Initially the window is not visible.\
If there is already a window with the given name, it will be closed and destroyed prior to creating the new window.\
Use the form controller show() and showRecords() methods in order to show a form in this window.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **windowName** the name of the window. Should not be null.
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **type** the type of the window. Can be one of JSWindow\.DIALOG, JSWindow\.MODAL\_DIALOG, JSWindow\.WINDOW (WINDOW doesn't work in NGClient).
* [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) **parentWindow** the parent JSWindow object. If it is not specified, the current window will be used as parent. This parameter is only used by dialogs.

**Returns:** [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) the newly created window.

**Sample**

```js
// create and show a window, with specified title, initial location and size (WINDOW does not work for NGClient)
var win = application.createWindow("windowName", JSWindow.DIALOG);
win.setInitialBounds(10, 10, 300, 300);
win.title = "This is a window";
controller.show(win);
// create and show a non-modal dialog with default initial bounds/title
var nmd = application.createWindow("nonModalDialogName", JSWindow.DIALOG);
controller.showRecords(15, nmd); // 15 is a single-number pk in this case
```

### executeLater(function, delay)

Runs at method at the given delay in milliseconds.

This is like a simple scheduler to quickly run something after a bit of delay

**Parameters**

* [Function](/reference/servoycore/dev-api/js-lib/function.md) **function** The function to call
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **delay** The millis that has to elapse before the function is called.

**Returns:** void

### executeLater(function, delay, arguments)

Runs at method at the given delay in milliseconds with the arguments given to the method.

This is like a simple scheduler to quickly run something after a bit of delay

**Parameters**

* [Function](/reference/servoycore/dev-api/js-lib/function.md) **function** The function to call
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **delay** The millis that has to elapse before the function is called.
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **arguments** The arguments that are given to the function when called.

**Returns:** void

### executeProgram(program)

Execute a program and returns output. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The output generated by the program execution.

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgram("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgram("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgram(program, params)

Execute a program and returns output. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The output generated by the program execution.

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgram("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgram("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgram(program, params, environmentVars)

Execute a program and returns output. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **environmentVars** array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The output generated by the program execution.

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgram("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgram("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgram(program, params, environmentVars, startDir)

Execute a program and returns output. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **environmentVars** array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
* [String](/reference/servoycore/dev-api/js-lib/string.md) **startDir** the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The output generated by the program execution.

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgram("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgram("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgram("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgram("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgram("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgramInBackground(program)

Execute a program in the background. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute

**Returns:** void

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgramInBackground("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgramInBackground("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgramInBackground("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgramInBackground(program, params)

Execute a program in the background. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments

**Returns:** void

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgramInBackground("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgramInBackground("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgramInBackground("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgramInBackground(program, params, environmentVars)

Execute a program in the background. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **environmentVars** array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.

**Returns:** void

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgramInBackground("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgramInBackground("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgramInBackground("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### executeProgramInBackground(program, params, environmentVars, startDir)

Execute a program in the background. Specify the cmd as you would do in a console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **program** (fullpath) of the program to execute
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **params** an array of strings as program arguments
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **environmentVars** array of strings, each element of which has environment variable settings in the format name=value, or null if the subprocess should inherit the environment of the current process.
* [String](/reference/servoycore/dev-api/js-lib/string.md) **startDir** the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.

**Returns:** void

**Sample**

```js
// For Windows systems:
// Runs a binary located in the user's home directory. The application will run in the current working
// directory, which in general is the one where Servoy was started from.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"]);
// The same as above, but run the application in the user's home directory.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], null, "c:\\Users\\myself\\");
// The same as above, but also set an environment variable for the called program.
application.executeProgramInBackground("c:\\Users\\myself\\myapp.exe", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "c:\\Users\\myself\\");
// For non-Windows systems:
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"]);
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], null, "/home/myself/");
application.executeProgramInBackground("/home/myself/myapp", ["arg1", "arg2", "arg3"], ["MY_ENV_VAR=something"], "/home/myself/");
// Open a file with the default application associated with it. (on Windows)
application.executeProgramInBackground("rundll32.exe", ["url.dll,FileProtocolHandler", "filename"]);
// Open a file with the default application associated with it. (on Linux)
application.executeProgramInBackground("xdg-open", ["filename"]);
// Open a file with the default application associated with it. (on MacOS)
application.executeProgramInBackground("open", ["filename"]);
// Open a file with a specific application (on MacOS).
application.executeProgram("open", ["-a", "OpenOffice.org.app", "filename.doc"]);
```

### exit()

Stop and exit application.

**Returns:** void

**Sample**

```js
// exit application
application.exit();
```

### getActiveClientCount(currentSolutionOnly)

Get the active user count on the server (can be limited to current solution).

**Parameters**

* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **currentSolutionOnly** Boolean (true) to get the active user count on server only to the current solution

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Active user count on the server

**Sample**

```js
var count = application.getActiveClientCount(true);
```

### getActiveWindow()

This gets the currently focused active window; this can be the main application window or a modal dialog.\
For a webclient getWindow() can return the main window that is not really the main for the current tab in the browser\
that can return the previous tab that a user could have opened. For this method is better suited because this\
will give you the actual tab in the browser. Another call would be form.controller.getWindow() of a form that you know in which window it resides.

**Returns:** [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) the current active/focussed window.

**Sample**

```js
// get the currently active/focused window or dialog
var activeWindow = application.getActiveWindow();
```

### getApplicationType()

Get the application type.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Constant application type

**Sample**

```js
var type = application.getApplicationType();
//see application type contstant
```

### getClientCountForInfo(info)

Gets the count for all clients displaying the same additional information in the Clients page of Servoy Server Administration Console.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **info** The additional client info string to search for.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Number of clients

**Sample**

```js
var count = application.getClientCountForInfo('SaaS company name');
application.output('Including yourself, there are ' + count + ' client(s) running on behalf of the company.');
```

### getClientProperty(name)

Sets a UI property as a global value.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **name** Name of the client property

**Returns:** [Object](/reference/servoycore/dev-api/js-lib/object.md) the property value for the given name/key, null of nothing was found

**Sample**

```js
//Only use this function from the solution on open method!
application.putClientProperty(APP_NG_PROPERTY.VALUELIST_CONTAINS_SEARCH, true);
```

### getClipboardString()

Gets a string from the clipboard, null if not a string or empty.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) The string from the clipboard

**Sample**

```js
var fromClipboard = application.getClipboardString();
```

### getHostName()

Get the name of the localhost.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Name of the localhost

**Sample**

```js
var hostName = application.getHostName();
```

### getIPAddress()

Get the clients' IP address.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) IP address of the client

**Sample**

```js
var ip = application.getIPAddress();
```

### getLicenseNames()

Get the names of the used client licenses (as strings in array).

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Client licenses names

**Sample**

```js
var array = application.getLicenseNames();
```

### getLogger()

Get a JSLogger instance which offers an API for logging with arguments.\
Available logging levels are (in order): fatal, error, warn, info, debug and trace.\
If no loggerName is given to this method, it returns the default logger (LoggerFactory.getLogger(Debug.class))\
NOTE: the default logging level of the the default logger is 'warn', so info, debug and trace events are not logged.

**Returns:** [JSLogger](/reference/servoycore/dev-api/application/jslogger.md) a new JSLogger instance

**Sample**

```js
var log = application.getLogger(); // returns the default logger.
application.output("is logging level 'warn' enabled? " + log.isWarnEnabled); // if false, next line won't log
log.warn.log("this logger logs {} {} {}", "all", "my", "arguments");
```

### getLogger(loggerName)

Get a JSLogger instance which offers an API for logging with arguments. Available logging levels are (in order): fatal, error, warn, info, debug and trace. The argument should be the name of a logger that is configured in myServoyInstallationDir/application\_server/log4j.xml. A new logger can be configured in log4j.xml by adding the following line: \<Logger name="myLogger" level="INFO"/>

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **loggerName** the name of the logger, as configured in log4j.xml

**Returns:** [JSLogger](/reference/servoycore/dev-api/application/jslogger.md) a new JSLogger instance

**Sample**

```js
var log = application.getLogger("myLogger");
application.output("is logging level 'warn' enabled? " + log.isWarnEnabled); // if false, next line won't log
log.warn.log("this logger logs {} {} {}", "all", "my", "arguments");
```

### getOSName()

Returns the name of the operating system of the client. Will return "OSFamily majorVersion.minorVersion".

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Name of the operating system of the client

**Sample**

```js
var osname = application.getOSName();
```

### getScreenHeight()

Get the screen height in pixels.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Screen height

**Sample**

```js
var height = application.getScreenHeight();
```

### getScreenWidth()

Get the screen width in pixels.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Screen width

**Sample**

```js
var width = application.getScreenWidth();
```

### getServerTimeStamp()

Returns a date object initialized on server with current date and time.\
For NG and web clients this is the same as new Date() in scripting.

**Returns:** [Date](/reference/servoycore/dev-api/js-lib/date.md) Server time

**Sample**

```js
var servertime = application.getServerTimeStamp();
```

### getServerURL()

Gets the HTTP server url.

For an NGClient this will be the url that the user sees in the browser url bar.\
For Headless pure server based clients this will just be <http://localhost\\[:port>]

This method can throw an exception if the server url couldn't be retrieved from the client, for example if the user already closed its tab or due to some network problem.

This url will end with a / so don't append to this server url something that starts with a / again\
because RFC 3986 says that the path of a url (the part after the domain\[:poort]) can not start with 2 slashes.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) HTTP server URL

**Sample**

```js
var url = application.getServerURL();
```

### getServerUUID()

Get the uuid from this server instance (the same value that is shown on the admin page)

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) the UUID of the server instance.

**Sample**

```js
var uuid = application.getServerUUID();
```

### getServoyProperty(name)

Get a persistent property value (from servoy.properties file).

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the property

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Property value

**Sample**

```js
var value = application.getServoyProperty('ServerManager.numberOfServers');
```

### getServoyPropertyNames()

Get all persistent property names (from servoy.properties file).

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Array of all property names

**Sample**

```js
// display all properties
allPropertyNames = application.getServoyPropertyNames();
for(var i = 0; i < allPropertyNames.length; i++)
{
	application.output(allPropertyNames[i] + " = " + application.getServoyProperty(allPropertyNames[i]));
}
```

### getSolutionName()

Returns the name of the current solution.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Current solution name

**Sample**

```js
var solutionName = application.getSolutionName();
```

### getSolutionRelease()

Get the solution release number.

**Returns:** [Number](/reference/servoycore/dev-api/js-lib/number.md) Current solution release number

**Sample**

```js
var release = application.getSolutionRelease();
```

### getStartupArguments()

Get the parameters which are provided by startup.\
It returns an array with 2 elements, a string that is the startup argument and a map containing all named startup arguments, or\
null if there is no argument passed

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Array with 2 elements, a string that is the startup argument and a map containing all named startup arguments, or null if there is no argument passed

**Sample**

```js
var args_array = application.getStartupArguments();
// the first element in the array is the 'argument' value from the startup
var argument = args_array[0];
// the second element is a map  containing all the named startup arguments
var startupArgumentObj = args_array[1];
var arg1 = startupArgumentObj['arg1_name'];
var arg2 = startupArgumentObj['arg2_name'];
```

### getTimeStamp()

Returns a date object initialized in client with current date and time.\
For NG clients this is only useful when displaying on the client using format property (Use local time), and then\
this is equivalent to new Date() on the client side, so basically this can be used to pre-fill with 'now' such a display.

**Returns:** [Date](/reference/servoycore/dev-api/js-lib/date.md) Current time at the client

**Sample**

```js
var clienttime = application.getTimeStamp();
```

### getUUID()

Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.

**Returns:** [UUID](/reference/servoycore/dev-api/application/uuid.md) The new UUID object

**Sample**

```js
var new_uuid_object = application.getUUID(); // generate new uuid object
var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object
var uuid_object2 = application.getUUID(new_uuid_object.toBytes());  // convert a byte array representing an uuid to an uuid object
```

### getUUID(byteArray)

Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.

**Parameters**

* [Array](/reference/servoycore/dev-api/js-lib/array.md) **byteArray** Byte array representing an uuid

**Returns:** [UUID](/reference/servoycore/dev-api/application/uuid.md) The new UUID object

**Sample**

```js
var new_uuid_object = application.getUUID(); // generate new uuid object
var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object
var uuid_object2 = application.getUUID(new_uuid_object.toBytes());  // convert a byte array representing an uuid to an uuid object
```

### getUUID(uuidString)

Get a new UUID object (also known as GUID) or convert the parameter (that can be string or byte array) to an UUID object. A table column marked as UUID will work with such objects.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **uuidString** String representing an uuid

**Returns:** [UUID](/reference/servoycore/dev-api/application/uuid.md) The new UUID object

**Sample**

```js
var new_uuid_object = application.getUUID(); // generate new uuid object
var uuid_object1 = application.getUUID(new_uuid_object.toString()); // convert a string representing an uuid to an uuid object
var uuid_object2 = application.getUUID(new_uuid_object.toBytes());  // convert a byte array representing an uuid to an uuid object
```

### getUserProperty(name)

Get a persistent user property.\
In NGClient this is stored in the locale storage of the browser, so it will be persisted over restarts as long as the user didn't clear the data.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the property

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Property value

**Sample**

```js
var value = application.getUserProperty('showOrders');
```

### getUserPropertyNames()

Get all persistent user property names.

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Array of all user property names

**Sample**

```js
// display all user properties
allPropertyNames = application.getUserPropertyNames();
for(var i = 0; i < allPropertyNames.length; i++)
{
	application.output(allPropertyNames[i] + " = " + application.getUserProperty(allPropertyNames[i]));
}
```

### getValueListArray(name)

Retrieve a valuelist as array, to get real-values for display-values.\
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** The name of the valuelist

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Named array for the valuelist

**Sample**

```js
var packet_types = application.getValueListArray('packet_types');
if (a_realValue == packet_types['displayValue'])
{
}
```

### getValueListDisplayValue(name, realValue)

Retrieve a valuelist display-value for a real-value.\
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **realValue** Real value of the valuelist

**Returns:** [Object](/reference/servoycore/dev-api/js-lib/object.md) Display value of the real value from the valuelist

**Sample**

```js
var displayable_status = application.getValueListDisplayValue('case_status',status);
```

### getValueListItems(name)

Get all values from a custom or database type value list as dataset (with columns displayValue,realValue).\
NOTE: this doesn't return a value for a valuelist that depends on a database relation or is a global method valuelist.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist

**Returns:** [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) DataSet with valuelist's display values and real values

**Sample**

```js
//Note:see databaseManager.JSDataSet for full details of dataset
var dataset = application.getValueListItems('my_en_types');
//example to calc a strange total
global_total = 0;
for( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
	global_total = global_total + dataset.getValue(i,1);
}
//example to assign to dataprovider
//employee_salary = dataset.getValue(1,1)
```

### getValueListNames()

Get all the valuelist names as array.

**Returns:** [Array](/reference/servoycore/dev-api/js-lib/array.md) Array with all valuelist names

**Sample**

```js
var array = application.getValueListNames();
```

### getVersion()

Returns the application version.

**Returns:** [String](/reference/servoycore/dev-api/js-lib/string.md) Application version

**Sample**

```js
application.getVersion();
```

### getVersionInfo()

Get the full version information of this solution and all its modules.\
This will return an object that is a map of Name(Sting)->Version(String) of the solution and all its modules.

**Returns:** [Object](/reference/servoycore/dev-api/js-lib/object.md) Name->Version map object.

### getWindow()

Get the main application window. This is the window that is created first for this client.

In a browser client the user may open the same solution in a new tab in the same browser. In that case the main solution\
window will always be the first opened tab, even if that one was already closed.\
application.getActiveWindow() will always return the currently active/focused window or dialog.\
If you need the window of the current top-level form, controller.getWindow() of that form will\
always return the correct window.

**Returns:** [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) the main application JSWindow.

**Sample**

```js
// close and dispose window resources
var mainAppWindow = application.getWindow();
```

### getWindow(name)

Get a window by window name. When not supplying a name, the main application window is grabbed.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** the name of the window. If not specified, the main application JSWindow will be returned.

**Returns:** [JSWindow](/reference/servoycore/dev-api/application/jswindow.md) the JSWindow with the specified name, or null if no such window exists.

**Sample**

```js
// close and dispose window resources
var win = application.getWindow("someWindowName");
if (win != null) {
	win.destroy();
}
```

### isInDeveloper()

Returns true if the solution is running in the developer.

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if the solution is running in the developer, (false) otherwise

**Sample**

```js
var flag = application.isInDeveloper();
```

### output(msg)

Output something on the out stream. (if running in debugger view output console tab)

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **msg** Object to send to output stream

**Returns:** void

**Sample**

```js
// log level is used to determine how/if to log in servoy_log.txt
application.output('my very important trace msg');// default log level: info
```

### output(msg, level)

Output something on the out stream. (if running in debugger view output console tab)

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **msg** Object to send to output stream
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **level** the log level where it should log to.

**Returns:** void

**Sample**

```js
// log level is used to determine how/if to log in servoy_log.txt
application.output('my very important msg',LOGGINGLEVEL.ERROR);// log level: error
```

### overrideStyle(originalStyleName, newStyleName)

It overrides the original stylesheet media defined on a solution with another media.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **originalStyleName** Name of the style to override
* [String](/reference/servoycore/dev-api/js-lib/string.md) **newStyleName** Name of the new style

**Returns:** void

**Sample**

```js
application.overrideStyle('oldstylesheet.css','mystylesheets/newstylesheet.css');
//Also less is supported also with compiling it at runtime
application.overrideStyle('solution.less', 'tenant.less'); // tenant.less can be a solution model changed or generated file, then it will be recompiled at runtime.
```

### putClientProperty(name, value)

Sets a UI property as a global value.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **name** Name of the client property
* [Object](/reference/servoycore/dev-api/js-lib/object.md) **value** New value of the client property

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if the client property was set with the new value

**Sample**

```js
//Only use this function from the solution on open method!
application.putClientProperty(APP_NG_PROPERTY.VALUELIST_CONTAINS_SEARCH, true);
```

### refreshGlobalMethodValueList(element)

Refresh a global method valuelist by forcing it to call the global method. The element which has the valuelist must be provided.\
If there is no propertyName specified, the element must have only one valuelist property.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **element** form element

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) boolean indicating if valuelist was refreshed

**Sample**

```js
application.refreshGlobalMethodValueList(elements.mytypeahead);
```

### refreshGlobalMethodValueList(element, propertyName)

Refresh a global method valuelist by forcing it to call the global method. The element which has the valuelist must be provided.\
The valuelist is searched under provided property from the spec - for usage in NGClient custom components.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **element** form element
* [String](/reference/servoycore/dev-api/js-lib/string.md) **propertyName** name of property from the spec

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) boolean indicating if valuelist was refreshed

**Sample**

```js
application.refreshGlobalMethodValueList(elements.mycustomcomponent,'myvaluelistProperty');
```

### removeAllClientInfo()

Removes all names given to the client via the admin page.

**Returns:** void

**Sample**

```js
application.removeAllClientInfo();
```

### removeAllUserProperties()

Removes all user properties.

**Returns:** void

### removeClientInfo(info)

Removes a string of client information which is stored on the server and\
previously was added using the application.addClientInfo('client info')

This function can be called more than once, if you want to delete multiple\
lines of client information.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **info** A line of text to be removed from the client information\
  on behalf of the running Servoy client.

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) boolean indicator if info was removed successfully

**Sample**

```js
var removed = application.removeClientInfo('SaaS company name');
```

### removeUserProperty(name)

Removes a user property.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the user property

**Returns:** void

### setClipboardContent(string)

Sets a string object in the clipboard.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **string** New content of the clipboard

**Returns:** void

**Sample**

```js
application.setClipboardContent('test');
```

### setUserProperty(name, value)

Sets a user property for this client:\
In NGClient/Titanium Client this is stored in the locale storage of the browser, so it will be persisted over restarts as long as the user didn't clear the data.\
For headless clients(including Batch Processors and Authentication clients) the user property is stored in memory and will be lost upon client restart.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the user property
* [String](/reference/servoycore/dev-api/js-lib/string.md) **value** New value of the user property

**Returns:** void

**Sample**

```js
application.setUserProperty('showOrders','1');
```

### setValueListItems(name, dataset)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) **dataset** Dataset with display/real values

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### setValueListItems(name, dataset, autoconvert)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [JSDataSet](/reference/servoycore/dev-api/database-manager/jsdataset.md) **dataset** Dataset with display/real values
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **autoconvert** Boolean (true) if display values and return values should be converted to numbers

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### setValueListItems(name, displayValues)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **displayValues** Display values array

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### setValueListItems(name, displayValues, autoconvert)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **displayValues** Display values array
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **autoconvert** Boolean (true) if display values and return values should be converted to numbers

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### setValueListItems(name, displayValues, realValues)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** Name of the valuelist
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **displayValues** Display values array
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **realValues** Real values array

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### setValueListItems(name, displayValues, realValues, autoconvert)

Fill a custom type valuelist with values from array(s) or dataset.

NOTE: if you modify values for checkbox/radio field, note that having one value in valuelist is a special case, so switching between one value and 0/multiple values may have side effects\
NOTE: This is expensive operation, which triggers refresh of all visible forms. Over usage of this method may inflict performance issues.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **name** ;
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **displayValues** Display values array
* [Array](/reference/servoycore/dev-api/js-lib/array.md) **realValues** Real values array
* [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) **autoconvert** Boolean (true) if display values and return values should be converted to numbers

**Returns:** void

**Sample**

```js
//set display values (return values will be same as display values)
application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'));
//set display values and return values (which are stored in dataprovider)
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array(10000,10010,10456));
//set display values and return values converted to numbers
//application.setValueListItems('my_en_types',new Array('Item 1', 'Item 2', 'Item 3'),new Array('10000','10010', '10456'), true);
//do query and fill valuelist (see databaseManager for full details of queries/dataset)
//var query = 'select display_value,optional_real_value from test_table';
//var dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()), query, null, 25);

//application.setValueListItems('my_en_types',dataset);
```

### showForm(form)

Show the form specified by the parameter, that can be a name (is case sensitive!) or a form object.\
This will show the form in the active/currently focused window. So when called from a form in a dialog the dialog will show the form.

**Parameters**

* [Object](/reference/servoycore/dev-api/js-lib/object.md) **form** Form object or name

**Returns:** void

**Sample**

```js
application.showForm('MyForm');
```

### showURL(url)

Shows an URL in a browser.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **url** URL to show

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if URL was shown

**Sample**

```js
application.showURL('http://www.example.com');
```

### showURL(url, browserTarget)

Shows an URL in a browser.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **url** URL to show
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTarget** Target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '\_self' is current window,'\_blank' is new dialog, '\_top' is main window; default is '\_blank'

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if URL was shown

**Sample**

```js
application.showURL('http://www.example.com');
```

### showURL(url, browserTarget, timeout)

Shows an URL in a browser.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **url** URL to show
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTarget** Target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '\_self' is current window,'\_blank' is new dialog, '\_top' is main window; default is '\_blank'
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **timeout** A timeout in seconds when the url should be shown

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if URL was shown

**Sample**

```js
application.showURL('http://www.example.com');
```

### showURL(url, browserTarget, browserTargetOptions)

Shows an URL in a browser.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **url** URL to show
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTarget** Target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '\_self' is current window,'\_blank' is new dialog, '\_top' is main window; default is '\_blank'
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTargetOptions** Dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no'

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if URL was shown

**Sample**

```js
application.showURL('http://www.example.com');
```

### showURL(url, browserTarget, browserTargetOptions, timeout)

Shows an URL in a browser.

**Parameters**

* [String](/reference/servoycore/dev-api/js-lib/string.md) **url** URL to show
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTarget** Target frame or named dialog/window, so its possible to control in which (internal) frame or dialog the url is loaded, '\_self' is current window,'\_blank' is new dialog, '\_top' is main window; default is '\_blank'
* [String](/reference/servoycore/dev-api/js-lib/string.md) **browserTargetOptions** Dialog options used when a dialog is specified, example: 'height=200,width=400,status=yes,toolbar=no,menubar=no,location=no'
* [Number](/reference/servoycore/dev-api/js-lib/number.md) **timeout** A timeout in seconds when the url should be shown

**Returns:** [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) Boolean (true) if URL was shown

**Sample**

```js
application.showURL('http://www.example.com');
```

### sleep(ms)

Sleep for specified time (in milliseconds).

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **ms** Sleep time in milliseconds

**Returns:** void

**Sample**

```js
//Sleep for 3 seconds
application.sleep(3000);
```

### updateUI()

Updates the UI (painting). If in a script an element changed and the script continues doing\
things, you can give an number in ms how long this can take.\
Warning: this gives the UI time to paint, but this also means that it will give the ui time to respond to all other events,\
so if a user keeps clicking on other stuff this will also be handled right away inside this call.

NOTE:In NGClient, this method will send to browser all outstanding changes. If called too often (with many changes), can cause performance issues.

**Returns:** void

**Sample**

```js
application.updateUI(500);
//continue doing things
```

### updateUI(milliseconds)

Updates the UI (painting). If in a script an element changed and the script continues doing\
things, you can give an number in ms how long this can take.\
Warning: this gives the UI time to paint, but this also means that it will give the ui time to respond to all other events,\
so if a user keeps clicking on other stuff this will also be handled right away inside this call.

NOTE:In NGClient, this method will send to browser all outstanding changes. If called too often (with many changes), can cause performance issues.

**Parameters**

* [Number](/reference/servoycore/dev-api/js-lib/number.md) **milliseconds** How long the update should take in milliseconds

**Returns:** void

**Sample**

```js
application.updateUI(500);
//continue doing things
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/dev-api/application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
