|Best Practices | System Properties|
This article describes how system administrators can manage script behavior by creating system properties to use in scripts. Best practices include:
- Using system properties instead of hard-coded values.
- Defining and using naming conventions.
- Grouping properties into categories.
- Creating properties pages.
System properties are maintained in the System Property table.
|Best Practice #1: Use system properties instead of hard-coded values.|
When required values are hard-coded into the server-side scripts, changes to these values must be manually adjusted in every script where they appear. To save time and maintenance, create system properties with scripts using the values contained in those properties. When a system change is required, changes made to a single system property can be implemented system-wide.
|Best Practice #2: Define and use a naming convention.|
Define and use a naming convention that makes the property easy to manage. This allows users to filter custom properties from the hundreds in the system properties list.
To define a property:
- Create a property name with the company name.
- Add the application or process name (or both) using a dot notation to separate the elements.
- Add a description that is short and meaningful. If the property refers to a script, include the script name. For example, cd.default.assignment_group.
- To create system properties for the values:
- Enter sys_properties.list in the Navigation filter.
- Check for an existing property with the needed functionality before creating a new one.
- Click New.
- In the Name field, enter cd.default.assignment_group (for example).
- In the Description field, enter the default assignment group description.
- From the Type choice list, select string.
- In the Value field, enter the corresponding value for the default assignment group.
- Click Submit.
|Best Practice #3: Group properties into categories.|
To create a category to group properties:
- Navigate to System Properties > Categories.
- Click New.
- In the Name field, enter the new category.
- In the Description field, enter the category description.
- Right-click the form header and select Save.
The properties-related list is now displayed.
- Click Edit.
- Select the properties and Add them to the new category.
|Best Practice #4: Create a Properties page to display properties.|
The Properties page gives easy access to all of the properties in one place. To display properties, create a new module under the appropriate application menu.
- Right-click the application and select Edit Application Menu.
- In the modules-related list, click New.
- For Title, enter Properties.
- For Link type, select URL (from Arguments).
- For Roles, select admin.
- For Order, use the number where this should appear on the application menu.
- Click the image icon.
- Select the Properties icon.
- For Arguments, use the system properties UI page.
- Click Submit. The property page now appears in the application menu.
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 might cause temporary performance issues to the instance if done excessively. As an alternative to a system property to store configuration information that changes more than once or twice a month, you can use instead a custom table to store regularly changing configuration information.