UserPreference
Creates a User Preference (sys_user_preference).
Signature
UserPreference(config)
Parameters
config
UserPreference
an object containing the following properties:
Properties:
-
$id (required):
string | number | ExplicitKey<string> -
name (required):
stringName of the feature or functionality -
type (required):
'string' | 'boolean' | 'image' | 'password2' | 'date_format' | 'integer' | 'choicelist' | 'time_format' | 'color' | 'uploaded_image' | 'password' | 'timezone' | 'short_string'The data type of entry accepted for thevalue -
value (required):
string | number | booleanCurrent setting for this record -
$meta (optional):
object- installMethod:
'first install' | 'demo' | 'once'Map a record to an output folder that loads only in specific circumstances. 'first install' - > 'unload', 'demo' -> 'unload.demo'
- installMethod:
-
description (optional):
stringShort description of the feature or functionality -
system (optional):
booleanWhether this record indicates the system-wide default
See
Examples
Basic String Preference
Create a string user preference with a default value
/**
* @title Basic String Preference
* @description Create a string user preference with a default value
*/
import { UserPreference } from '@servicenow/sdk/core'
UserPreference({
$id: Now.ID['pref-id'],
name: 'my-pref',
type: 'string',
value: 'hello world',
description: 'this is the description',
system: false,
})