Application Properties
Application properties provide the ability to hold easy to maintain, configurable values that can provide the ability to separate and toggle functionality based on its value. These properties can be used within code and also can be secured based on a user's role on who can edit them. Within the base platform this is used in a few places to provide the ability to turn on and off and change functionality without having to change the code that refers to it.
Application properties create/update
Go to Application properties by navigating to Application > Application > Application properties
The following are the fields you can populate when creating/updating a property:
Field | Type | Example | Notes / Description |
|---|---|---|---|
Application property key | String | incident.auto_closure.enabled | The value that is used when referencing this property from within a script or within the system. It needs to be unique for the whole platform. |
Property type | String | boolean | The type of value this property holds. Available types include: byte, locale, timezone, string, boolean, integer and long. |
Client side accessible | Boolean | false | This determines if the property can be accessed via client side scripts. |
Roles | Multiple reference [Role Table] | itsm_administrator | A user needs one of the following roles to be able to update this property. If this is blank, it defaults to Administrator. Note that it only provides the ability to update the value and no other fields. |
Application properties value | String | true | The value of the application property that will be provided upon being accessed. |
Organization | Reference [Organization Table] | global | The organization this is for. As of the current version of the platform, this should be kept as global. |
Application | Reference [Application Table] | itsm | The application that this property is a part of. |
Description | String | This property is used to flag whether or not the auto-closure (resolved -> closed) is active for incidents | A description of what the property does, however has no functionality tied to it. |
Example
How to access application properties
Application properties can be accessed both on server side by default and client side if the client side accessible flag has been set to true. To access the property, there are different ways to access these properties depending on if it is server or client side.
Server side
When trying to access an application property on the server side, there is one way to access these properties. These will return the application property value as a string.
These can be accessed as per below.
ApplicationPropertyManager.getProperty(<property_name>)Client side
When trying to access an application on the server side, there are multiple ways to access properties.
If you are attempting to access a boolean property, you can use the following method to return the value in the boolean data type.
//Only using 1 parameter will simply return the property or undefined.
User.getBooleanProperty(<property_name>);
//If you include both parameters and the property does not exist, the second parameter will be the default value where the property doesn't exist.
User.getBooleanProperty(<property_name>, <default_value>);For any other properties, you can use the following method to return the value in the string data type.
//Only using 1 parameter will simply return the property or undefined.
User.getProperty(<property_name>);
//If you include both parameters and the property does not exist, the second parameter will be the default value where the property doesn't exist.
User.getProperty(<property_name>, <default_value>);