Skip to content

Settings

Public surface of the Settings service.

Every operation is user-scoped: userId identifies whose settings are read or written.

Usage

Prerequisites: Initialize the SDK first - see Getting Started

import { Settings, PlatformSettingKey } from '@uipath/uipath-typescript/settings';

const settings = new Settings(sdk);
const stored = await settings.getUserSettings([PlatformSettingKey.UserTheme], '<userId>');

Methods

getUserSettings()

getUserSettings(keys: PlatformSettingKey[], userId: string): Promise<PlatformSetting[]>

Gets a user's platform settings by key.

Returns one entry per key that has a stored value for that user, each carrying the value plus the organization and user it belongs to. Keys with nothing stored are omitted from the response rather than returned with an empty value, so the result may be shorter than the list of keys requested.

Parameters

Parameter Type Description
keys PlatformSettingKey[] Setting keys to fetch
userId string GUID of the user whose settings to read

Returns

Promise<PlatformSetting[]>

The user's stored settings for the requested keys, as PlatformSetting rows

Examples

import { UiPath } from '@uipath/uipath-typescript/core';
import { Settings, PlatformSettingKey } from '@uipath/uipath-typescript/settings';

const sdk = new UiPath(config);
await sdk.initialize();

const settings = new Settings(sdk);
const stored = await settings.getUserSettings([PlatformSettingKey.UserTheme], '<userId>');
const theme = stored.find(s => s.key === PlatformSettingKey.UserTheme)?.value;
import { PlatformSettingKey } from '@uipath/uipath-typescript/settings';

const stored = await settings.getUserSettings(
  [
    PlatformSettingKey.UserTheme,
    PlatformSettingKey.UserAccessibility,
    PlatformSettingKey.UserCasePinnedInstancesByTenant,
  ],
  '<userId>'
);

// Structured settings arrive as a JSON string
const pinned = stored.find(s => s.key === PlatformSettingKey.UserCasePinnedInstancesByTenant);
const parsed = pinned ? JSON.parse(pinned.value) : {};

updateUserSettings()

updateUserSettings(settings: PlatformSettingUpsert[], userId: string): Promise<PlatformSetting[]>

Creates or updates a user's platform settings in bulk.

Each submitted key is upserted for that user — keys that do not yet exist are created, existing keys are overwritten. Keys absent from the request are left untouched, so there is no need to send back the settings you are not changing. Returns the stored rows as they are after the write, including their generated id.

Parameters

Parameter Type Description
settings PlatformSettingUpsert[] Settings to create or update
userId string GUID of the user whose settings to write

Returns

Promise<PlatformSetting[]>

The settings as stored after the write, as PlatformSetting rows

Examples

import { PlatformSettingKey } from '@uipath/uipath-typescript/settings';

const updated = await settings.updateUserSettings(
  [{ key: PlatformSettingKey.UserTheme, value: 'dark' }],
  '<userId>'
);
import { PlatformSettingKey } from '@uipath/uipath-typescript/settings';

await settings.updateUserSettings(
  [
    { key: PlatformSettingKey.UserTheme, value: 'dark' },
    { key: PlatformSettingKey.UserAccessibility, value: 'true' },
  ],
  '<userId>'
);