Please use for the latest documentation.

This site is for reference purposes only and may not be accurate for the latest ServiceNow version

System Properties Best Practices

From Wiki Archive
Jump to: navigation, search


System properties consist of a name, description, information type (for example, integer, string, true | false, and so forth), and system value. Using a system property instead of a hard-coded value in server-side scripts makes the system easier to maintain and gives you the flexibility to make changes to the system's behavior without reprogramming.

You can use the system properties already defined in the System Property [sys_properties] table, or you can create your own system properties to perform custom functions in the system. It is recommended that you use a standard naming convention for system properties, and create property categories for grouping related system properties.

These best practices are described in a sample scenario.


ServiceNow System Properties Best Practices

Sample Scenario

Assume you have been working with Acme Corporation's change management group to define their change process. While creating technical solutions, you have defined system-specific values, including:

Name Value
Default assignment group EU Infrastructure
Change coordinator Anna Johns
Task reminder period 3 days
Approval reminder period 2 days
Closure approval group EU Quality
Default change template Standard Change Template
Change debug false

If you enter these values in server-side scripts and later need to change any of the values, you must manually change each instance of the values. This can be time-consuming and costly. An example of this might be changing the Default assignment group from EU Infrastructure to US Infrastructure.

The solution is to create system properties and have scripts use the values contained in the properties. When a system change is required, it is easy to make the change in a single system property.

Warning: System properties store configuration information that rarely or never changes. Each time you change or add a system property, the system flushes the cache to keep all nodes in the cluster in synch. This cache flush has a very high performance cost for one to ten minutes, which can potentially cause an outage if done excessively. To prevent such outages, do not use a system property to store configuration information that changes more than once or twice a month. Instead, use a custom table to store regularly changing configuration information.

One of the challenges to having several properties is managing them. While it is possible to search for the desired property from the System Property [sys_properties] table, it is a good idea to create properties pages to group related properties. Properties pages allow you to easily change property values and remove the risk of someone making changes to other fields on the property, such as type or description.

Define a Naming Convention for System Properties

All properties have a Name field. By convention, the name of a property uses dot notation (for example, change.conflict.blackout). Before you create properties, define a naming standard. Using a naming standard makes it easier to filter lists of properties. Consider these suggestions when defining a naming standard:

  • Begin property names with your organization name (for example, acme.default.groupname).
  • Begin debug property names with the string debug (for example, acme.debug.idle.timeout).
  • Include the name of a script the property pertains to (for example, acme.debug.ChangeUtils).
  • Include the name of the application or process the property pertains to (for example, acme.loaner.return.reminder).

Create New Properties for Acme Corp.

You can create new properties and then add related properties to categories.

Note: Before creating a property, check to see if there is an existing property with the same functionality.
  1. In the application navigator filter, enter sys_properties.list.
  2. Click New.
  3. Fill in the following fields on the System Property form:
    • Name:
    • Description: Enter the group name of the default assignment group.
    • Type: string.
    • Value: EU Infrastructure.
  4. Click Submit.
  5. Repeat for any other properties you want to define using the appropriate names, descriptions, types, and values.

Group Properties into Categories

To make organizing system properties for Acme Corporation's change management process easier, you can create property categories.

  1. Navigate to System Properties > Categories.
  2. Click New.
  3. In the Name field, enter Acme Change.
  4. In the Title field, enter Properties to control the Acme CM process.
  5. Right-click the header bar and select Save.
  6. In the Properties related list, click Edit.
  7. Using the slushbucket, add the desired properties to the Properties List column.
    In this example, select anything that starts with acme.change.
  8. Click Save.
    The properties are added to the related list. The Order field indicates the order in which the properties will be displayed on the properties page when you create it. Change the order as needed.

Create a Properties Page

An easy way to access system properties is to create a properties page. In this scenario, a new properties page is added to the Change application.

  1. Right-click the Change application and select Edit Application Menu (Calgary release) or Edit Application (versions prior to Calgary).
    Any application can be launched in this manner.
  2. In the Modules related list, click New.
    Make a note of the order of the existing modules and determine where you want the new Properties module to appear.
  3. Fill in the following fields on the Module form:
    • Title: Properties
    • Order: Enter a value for the desired order of the module
    • Image: Select an icon for the module (most properties modules in the base system use Icon-reference.png)
    • Link type: URL (from Arguments:)
    • Roles: admin (Click the lock icon and use the slushbucket)
    • Arguments:: Change
  4. Click Submit.
    The application navigator refreshes automatically and the new module appears.
  5. Click the Properties module to see the new properties page, which contain the properties added to the category in the previous procedure.

Use Properties in Server-Side Scripts

Properties make it easy to change the behavior of the system. Use a property in a server-side script with the gs.getProperty() call, as in the example found in Debugging Tools Best Practices.

Creating and using properties makes maintenance quicker and easier. Organizing related properties in pages makes it easier to access those properties.