Property API - ServiceNow Fluent
The Property API defines system properties [sys_properties] that control instance behavior.
For general information about system properties, see Add a system property.
Property object
Add a system property [sys_properties] for configuring an aspect of an application.
| Name | Type | Description |
|---|---|---|
| $id | String or Number | Required. A unique ID for the metadata object. When you build the application, this ID is hashed into a unique sys_id. For more information, see ServiceNow Fluent language constructs. Format: |
| name | String | Required. The name of the property beginning with the application scope in the following format: <scope>.<name>. |
| value | Any | A value for the property. The value must be the correct data type. All property values are stored as strings. When retrieving properties via the gs.getProperty() method, treat the results as strings. For example, a true|false property returns 'true' or 'false' (strings), not the Boolean equivalent. |
| type | String | A data type for the property value. Valid values: string, integer, boolean, choicelist, color, date_format, image, password, password2, short_string, time_format, timezone, uploaded_image |
| description | String | A description of what the property does. |
| choices | Array | A comma-separated list of choice values. This property only applies if the type property is set to choicelist. If you need a different choice label and value, use an equal
sign (=) to separate the label from the value. For example, |
| roles | Object | The variable identifiers of Role objects or names of roles that have read or write access to the property. For example:For more information, see Role API - ServiceNow Fluent. |
| ignoreCache | Boolean | Flag that indicates whether to cache flush when the value of the property is set. The system stores system property values in server-side caches to avoid querying the database for configuration settings. When you change a system property value, the system flushes the cache for the System Properties [sys_properties] table. Use this field to determine whether to flush this property's value from all other server-side caches. Valid values:
Default: false |
| isPrivate | Boolean | Flag that indicates whether to exclude the property from being imported via update sets. Keeping system properties private helps prevent settings in one instance from overwriting values in another instance. For example, you might not want a system property in a development instance to use the same value as a production instance. Valid values:
Default: false |
| $meta | Object | Metadata for the application metadata. With the installMethod property, you can map the application metadata to an output directory that loads only in specific
circumstances. Valid values for installMethod:
|
import { Property } from '@servicenow/sdk/core'
Property({
$id: Now.ID['1234'],
name: 'x_snc_app.some.new.prop',
type: 'string',
value: 'hello',
description: 'A new property',
roles: {
read: ['admin'],
write: [adminRole, managerRole],
},
ignoreCache: false,
isPrivate: false,
})
import { Role } from "@servicenow/sdk/core";
const managerRole = Role({
$id: Now.ID['manager_role'],
name: 'x_snc_example.manager'
})
const adminRole = Role({
$id: Now.ID['admin_role'],
name: 'x_snc_example.admin',
containsRoles: [managerRole]
})