---
title: "RealmUtils"
site: api
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/api/2027.1/scripting/platform/realm-utils/
type: reference
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


`RealmUtils` is the global for maintaining realms from a server script. Each realm in the tree has a CIDR range, and each record of a realm-separated table carries its realm's CIDR. When you move a realm under a new parent, renumber it and correct its records with these methods. Realms and tenancy are explained in [Multi-tenancy](page:admin/access/roles-and-permissions/multi-tenancy) in the Administrator guide.

## Get an instance

`RealmUtils` is ready to use. Pass realm records from the `SystemRealm` table.

```javascript
let realm = Table("SystemRealm").get("<record id>");
RealmUtils.renumberDownstreamInclusive(realm);
```

## Methods

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `renumberDownstreamInclusive(realm)` | Nothing | Renumbers a realm and every realm below it, for example after the realm gets a new parent. A queued job then corrects the records of those realms. | 1.11 |
| `renumberDownstreamOnly(realm)` | Nothing | Renumbers only the realms below `realm` and keeps its own CIDR, so what users of `realm` see stays stable. Use it when nobody is signed in to the realms below. | 1.11 |
| `renumberAllRealms()` | Boolean | Renumbers every realm, then re-stamps every realm-separated record. Returns false when a table could not be updated. | 1.11 |
| `updateRealmCIDRsForAllTables()` | Boolean | Re-stamps every realm-separated record with its realm's current CIDR. Returns false when a table could not be updated. It can slow the instance, so run it out of hours. | 1.11 |
| `updateRealmCIDRsForTable(table)` | Boolean | Re-stamps the records of one table. Returns false when the table could not be updated. | 1.11 |
| `clearRealmRelatedCaches()` | Nothing | Clears the cached realm ranges and the realm tenancy provider's caches. | 1.11 |

<Callout type="info">
  **Changed in 2027.1.** `renumberAllRealms()`, `updateRealmCIDRsForAllTables()` and `updateRealmCIDRsForTable()` return nothing. `renumberDownstreamInclusive()` and `renumberDownstreamOnly()` queue no job to correct records, so run `updateRealmCIDRsForAllTables()` after them when the realms hold records. `updateRealmCIDRsForRealmSubtrees()` and `numberUnnumberedRealms()` are not available. Check scripts that use these methods before you upgrade.
</Callout>

## Examples

### Move a realm under a new parent

```javascript
let realm = Table("SystemRealm").get("<record id>");

realm.Parent("<record id>").update();
RealmUtils.renumberDownstreamInclusive(realm);
```

## Related

- [Multi-tenancy](page:admin/access/roles-and-permissions/multi-tenancy)
- [Multi-tenancy configuration](page:admin/access/roles-and-permissions/multi-tenancy-configuration)
- [user and User](page:scripting/platform/user)
