22. GlideSystemRunLevelAPI
ServiceNow provides a GlideSystemRunLevel API which allows applications to manage and control their operational state based on the current system run level. The system run level is a concept that defines the operational status of a ServiceNow instance and it can be set to one of the four defined levels: Fully Operational, Slightly Degraded, Moderately Degraded, and Severely Degraded.
The GlideSystemRunLevel API provides two methods to interact with the system run level: getCurrentLevel() and switchLevel(newLevel). The getCurrentLevel() method retrieves the current system run level, which can be fully_operational, slightly_degraded, moderately_degraded, or severely_degraded. The switchLevel(newLevel) method is used to switch the system run level to a new level specified by the newLevel parameter.
To use the GlideSystemRunLevel API, the admin role is required. Let’s take a look at some examples to see how the API can be used.
Example 1: Retrieve the current system run level
var currentRunLevel = sn_run_level.GlideSystemRunLevel.getCurrentLevel();
gs.info(currentRunLevel);
var newRunLevel = sn_run_level.GlideSystemRunLevel.switchLevel('slightly_degraded');
gs.info(newRunLevel);
In conclusion, the GlideSystemRunLevel API provides a convenient way for applications to manage and control their operational state in ServiceNow. By using the API, applications can respond to changes in the system run level and provide a better user experience.
https://medium.com/@LearnITbyPrashant/22-glidesystemrunlevelapi-49ea4265566e?source=rss-d005fc598f0a------2