GROW

code

Avoid updating system properties

This issue is found automatically by CODA.
Time to fix: 01h 15min

What is a System Property?

In ServiceNow, a System Property is a configuration setting that is used to store important information about the system. System properties are used to store a wide range of information, including settings for system behavior, performance, and security.

Why is this an issue?

System properties are used to store important configuration information that is used throughout the application. Updating a system property could have unintended consequences and could potentially break the application if not done carefully. System properties are typically set at the system level and are not intended to be modified by users.

In addition to the risk of breaking the application, modifying system properties can also have negative impacts on performance. Changing certain system properties may cause the system to behave differently, which can lead to slower performance or other issues.

In order to update a system property using a script, you will need to have the appropriate permissions. In most cases, this will require you to have the admin role. A example of this, would be:

1
2
3
4
5
6
7
8
// Get the current value of the property
var currentValue = gs.getProperty("your.property.name");

// Update the value of the property
gs.setProperty("your.property.name", "new value");

// Save the changes to the database
gs.save();

How do I fix it?

To change a system property back to its original value using a script in ServiceNow, you can use the GlideSystem API. Here is an example of how you can do this:

1
2
3
4
5
6
7
8
9
10
11
// Get the current value of the property
var currentValue = gs.getProperty("your.property.name");

// Store the original value in a separate variable
var originalValue = "original value";

// Update the value of the property
gs.setProperty("your.property.name", originalValue);

// Save the changes to the database
gs.save();

Keep in mind that you may need to search for the correct and original value of the system property you modified. This solution is a general one, and the specific steps you need to take may vary depending on the issue and the property you have changed.