---
title: "OptionsManager"
description: "Typed access to `app.option.get` / `user.option.get`, plus a save() that batches `*.option.set` with an optional Pull notification."
canonical_url: "https://bitrix24.github.io/b24jssdk/docs/working-with-the-rest-api/helper-options-manager"
last_updated: "2026-08-25"
---
# OptionsManager

> Typed access to `app.option.get` / `user.option.get`, plus a save() that batches `*.option.set` with an optional Pull notification.

`OptionsManager`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} is created twice — once for `app.option.get` and once for `user.option.get`. Reachable through [`B24HelperManager.appOptions`](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/helper.md#profileinfo--appinfo--paymentinfo--licenseinfo--currency--appoptions--useroptions) and [`B24HelperManager.userOptions`](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/helper.md#profileinfo--appinfo--paymentinfo--licenseinfo--currency--appoptions--useroptions). It treats option values as raw strings server-side and converts on read.

## Usage

```ts
import { useB24Helper, LoadDataType } from '@bitrix24/b24jssdk'

const { initB24Helper, getB24Helper } = useB24Helper()
await initB24Helper($b24, [LoadDataType.AppOptions, LoadDataType.UserOptions])

const helper = getB24Helper()

// Read with a default
const filters = helper.userOptions.getJsonObject('listFilters', {})
const itemsPerPage = helper.userOptions.getInteger('itemsPerPage', 20)

// Persist
await helper.appOptions.save(
  { theme: 'dark' },
  { moduleId: 'main', command: 'optionsChanged', params: { theme: 'dark' } }
)
```

## Typed Getters

| Method | Returns | Default | Notes |
| --- | --- | --- | --- |
| `getJsonArray(key, def?)` | `any[]`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `[]`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Parses JSON, also accepts JSON objects (returns `Object.values`). |
| `getJsonObject(key, def?)` | `object`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `{}`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Parses JSON, falls back to `def` on failure. |
| `getFloat(key, def?)` | `number`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `0.0`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Uses `Text.toNumber`. |
| `getInteger(key, def?)` | `number`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `0`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Uses `Text.toInteger`. |
| `getBoolYN(key, def?)` | `boolean`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `true`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `'Y'` → `true`, `'N'` → `false`. |
| `getBoolNY(key, def?)` | `boolean`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `false`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Same conversion as `getBoolYN`, different default. |
| `getString(key, def?)` | `string`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `''`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Calls `.toString()`. |
| `getDate(key, def?)` | `null \| DateTime`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | `null`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} | Uses `Text.toDateTime` (Luxon). |

## Static Helpers

```ts-type
OptionsManager.getSupportTypes(): TypeOption[]
OptionsManager.prepareArrayList(list: any): any[]
```

`TypeOption`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""} enumerates the supported value shapes (`NotSet / JsonArray / JsonObject / FloatVal / IntegerVal / BoolYN / StringVal`).

## Cache Methods

```ts-type
get data(): Map<string, any>
reset(): void
```

`data` is the raw key→string map. `reset()` clears the in-memory cache without touching the server.

## Save

```ts-type
save(
  options: Record<string, any>,
  optionsPull?: { moduleId: string, command: string, params: any },
  requestId?: string
): Promise<Result>
```

Issues a single batched call:

1. `app.option.set` for `appOptions` / `user.option.set` for `userOptions`, with the supplied `options` payload.
2. Optionally `pull.application.event.add` so other clients are notified about the change.

Both calls share `isHaltOnError: true`. Returns the wrapping [`Result`{className="language-ts-type shiki shiki-themes material-theme-lighter material-theme material-theme-palenight" language="ts-type" style=""}](https://bitrix24.github.io/b24jssdk/raw/docs/working-with-the-rest-api/core-result.md).

> [!NOTE]
> `save()` does **not** update the local cache. Call `getB24Helper().loadData([LoadDataType.AppOptions])` (or rerun `initB24Helper`) if you need the new state to be visible to subsequent `getX()` reads.

## Encoding Helpers

```ts-type
encode(value: any): string  // JSON.stringify wrapper
decode(data: string, defaultValue: any): any  // JSON.parse with logged failure
```

Convenience wrappers around `JSON.stringify` / `JSON.parse` that log parse failures through the manager's logger.

## Sitemap

See the full [sitemap](/b24jssdk/sitemap.md) for all pages.
