> For the complete documentation index, see [llms.txt](https://docs.servoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.servoy.com/reference/servoyextensions/modules/svycloudutils/svycloud.md).

# svyCloud

The `svyCloud` scope provides three things: a way to identify which environment your application is running in, and two functions for setting tenant-specific metadata on the current client session.

## Environment detection

### `CLOUD_ENVIRONMENT_TYPES`

A constant object with all supported environment types. Always reference it via the full scope path `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES` — using a shorthand or local variable will not work in Servoy.

| Constant                                                  | Value       |
| --------------------------------------------------------- | ----------- |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.PRODUCTION`      | `'prod'`    |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.PRE_PRODUCTION`  | `'preprod'` |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.USER_ACCEPTANCE` | `'uat'`     |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.DEVELOP`         | `'dev'`     |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.DEMO`            | `'demo'`    |
| `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.E2E`             | `'e2e'`     |

### `getCurrentEnvironment()`

Returns the current environment type as a string value from `scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES`.

When running inside Servoy Developer, this always returns `'dev'`. In a deployed cloud environment, the value comes from the `ENVIRONMENT` system property set by the cloud infrastructure.

```javascript
var env = scopes.svyCloud.getCurrentEnvironment();

if (env === scopes.svyCloud.CLOUD_ENVIRONMENT_TYPES.PRODUCTION) {
    // production-only logic
}
```

## Tenant management

Tenant information is stored as client info on the current session. Servoy Cloud uses this to identify which tenant a session belongs to — for example, in multi-tenant setups where a single cloud environment serves multiple customers.

{% hint style="warning" %}
Always use these functions instead of calling `application.addClientInfo()` directly. The functions handle deduplication: if a value is already set, it is removed before the new one is added. Calling `addClientInfo()` directly can result in duplicate entries.
{% endhint %}

### `setTenantName(value)`

Sets the tenant name for the current client session.

| Parameter | Type     | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `value`   | `String` | The tenant name to associate with this session |

```javascript
scopes.svyCloud.setTenantName('acme-corp');
```

### `setTenantValue(value)`

Sets the tenant value (typically a tenant ID or key) for the current client session.

| Parameter | Type     | Description                                     |
| --------- | -------- | ----------------------------------------------- |
| `value`   | `String` | The tenant value to associate with this session |

```javascript
scopes.svyCloud.setTenantValue('tenant-42');
```

### `setMaxIdleTime(timeInMinutes)`

Sets the maximum idle time for the current client session. When the session has been idle for this many minutes, Servoy Cloud will disconnect it and free up resources.

| Parameter       | Type     | Description             |
| --------------- | -------- | ----------------------- |
| `timeInMinutes` | `Number` | Idle timeout in minutes |

```javascript
// Disconnect after 30 minutes of inactivity
scopes.svyCloud.setMaxIdleTime(30);
```

Call this during session initialization — for example in the `onSolutionOpen` method of your solution's `preImport` module — to apply a tenant-specific or role-specific timeout.

## Build and version info

These functions return metadata injected by the Servoy Cloud pipeline. They return `null` if the values are not set (for example, when running in developer mode).

| Function                                | Returns  | Description                       |
| --------------------------------------- | -------- | --------------------------------- |
| `scopes.svyCloud.getJenkinsBuildNr()`   | `Number` | The Jenkins build number          |
| `scopes.svyCloud.getJenkinsBuildDate()` | `Date`   | The Jenkins build date            |
| `scopes.svyCloud.getSvnRevision()`      | `String` | The SVN revision at build time    |
| `scopes.svyCloud.getGitCommit()`        | `String` | The Git commit hash at build time |
| `scopes.svyCloud.getGitBranch()`        | `String` | The Git branch at build time      |
| `scopes.svyCloud.getSVNBranch()`        | `String` | The SVN branch at build time      |

These are useful for displaying version information in your application or for logging.

***

See also: [svyDataSeed](/reference/servoyextensions/modules/svycloudutils/svydataseed.md) for importing and exporting database seed data, and [svyDeployUtils](/reference/servoyextensions/modules/svycloudutils/svydeployutils.md) for database migrations and deployment utilities.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.servoy.com/reference/servoyextensions/modules/svycloudutils/svycloud.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
