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


`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/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 |

| Method | Returns | Description | Since |
| --- | --- | --- | --- |
| `updateRealmCIDRsForRealmSubtrees(realmIds)` | Nothing | Corrects the records of the realms below each ID in a comma-separated list. The platform queues this after a renumber, so you rarely call it. It raises an error when a table could not be updated. | 1.11 |
| `numberUnnumberedRealms()` | Object | Gives a range to every realm that has none and to the realms below it, then corrects their records. Returns `numbered`, `failed` and `stillUnnumbered` lists of realm IDs, and `recordsCorrected` and `succeeded` flags. Administrators only. | 1.11 |


## 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/multi-tenancy)
- [Multi-tenancy configuration](page:admin/access/multi-tenancy-configuration)
- [user and User](page:scripting/user)
