logo

NJP

ServiceNow Things to Know 9: GlideSystemRunLevel API

Import · Dec 09, 2023 · article

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);

Example 2: Switch the system run level to Slightly Degraded

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.

If my content helped you in anyway, please mark this content as BOOKMARK, SUBSCRIBE & HELPFUL

Best Regards,

Prashant Kumar (LearnIT)

YouTube Channel LearnIT: https://www.youtube.com/@learnitwithprashant

Blog LearnIT: https://medium.com/@LearnITbyPrashant

Prashant Kumar LinkedIn: https://www.linkedin.com/in/learnitbyprashant/

ServiceNow Community Prashant Kumar - https://www.servicenow.com/community/user/viewprofilepage/user-id/19635

View original source

https://www.servicenow.com/community/developer-blog/servicenow-things-to-know-9-glidesystemrunlevel-api/ba-p/2757609