Add or create properties to control system behavior. Use a system property instead of hard coding static data. System properties store configuration information that rarely or never changes.
Read more about System Properties in the ServiceNow Documentation
Access System Properties
You can access system properties via the Left Navigator Bar. There is also a trick to get to them quickly.
In the Navigation filter, enter sys_properties.list.
The entire list of properties in the System Properties [sys_properties] table appears.
Add a new System Property
After you get to the System Properties Page. Click New to add a new property
Editor’s Note: I only fill in the Name, Description, Type, and Value fields. Someday I may use the other fields. :)
Name - Name of the property you are creating.
Description - Type a brief, descriptive phrase describing the function of the property.
Choices - Comma-separated values for a choice list. If you need a different choice list label and value, use an equal sign (=) to separate the label from the value. For example, Blue=0000FF, Red=FF0000, Green=00FF00 displays Blue, Red, and Green in the list, and saves the corresponding hex value in the property value field.
Type | Select the appropriate data type from the list (for example, integer, string, or true|false).
Value | Set the desired value for property. 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.
Ignore cache | 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 always flushes the cache for the sys_properties table. Use this field to determine whether to flush this property's value from all other server-side caches.
Private | Set this property to true to exclude this property from being imported via update sets. Keeping system properties private prevents settings in one instance from overwriting values in another instance. For example, you may not want a system property in a development instance to use the same value as a production instance.
Read roles | Define the roles that have read access to this property.
Write roles | Defines the roles that have write access to this property.
Creating a System Properties Page
After you have created a number of system properties, you may want to create a System Properties page to easily find them. This is an optional step I use when creating an application.
Group via Category
Navigate to System Definition > Categories
Add a name and Title (Steal a title from an existing category)
Right Click and Save
In the Properties Related List, click Edit
Add the Properties you want to group into a category
Navigate to System Definition > Application Menus.
Search for the application you want to add the properties table to, for example System Properties.
Select an application that is restricted to the admin role so that non-admin users cannot access it.
From the Modules related list, click New.
Complete the form fields.
Link Type: URL (from Arguments:)
Arguments: system_properties_ui.do?sysparm_title=My%20Properties&sysparm_category=<your category here>
Using a System Property via script
var property = gs.getProperty('property_name');
To use a system property via client side, I use the business rule, client script combination
Display Business Rule
//A display business rule sends this information to the client using the following script: g_scratchpad.css = gs.getProperty('css.base.color'); g_scratchpad.hasAttachments = current.hasAttachments(); g_scratchpad.managerName = current.caller_id.manager.getDisplayValue();
// Check if the form has attachments if (g_scratchpad.hasAttachments) // do something interesting here else alert('You need to attach a form signed by ' + g_scratchpad.managerName);