Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Existing script/method to reliably determine if instance is Production

The SN Nerd
Giga Sage
Giga Sage

I'm looking for a way to determine if an instance is Production.

I noticed there is a system property, glide.installation.production

property.PNG

However, this is set to true on every instance!

On HI, the instance in question is listed correctly as being Non-Production.

hi.png

Is there a reliable, configuration agnostic way to tell from within the instance if it is Production or not?


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
2 ACCEPTED SOLUTIONS

GlideUtil.isProductionInstance()



However this is not available in Scoped Code.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

View solution in original post

JeffPatt
Tera Expert

As Dominic and Daniel have mentioned, the accepted solution is not correct at all.

 

For my use case I ended up setting a new System Property to store the name of the Production instance and a function in an open-access global scope Script Includes that performs an equality check against instance_name.

It's not OOTB, but has advantages in that it doesn't modify existing properties, and works.

View solution in original post

9 REPLIES 9

... Which in turn means that Pauls issue is not fixed with the accepted solution.
(I can see this here as well on a dev instance).


If this post was helpful, I would appreciate if you marked it as such - thanks!

Best
Daniel

JeffPatt
Tera Expert

As Dominic and Daniel have mentioned, the accepted solution is not correct at all.

 

For my use case I ended up setting a new System Property to store the name of the Production instance and a function in an open-access global scope Script Includes that performs an equality check against instance_name.

It's not OOTB, but has advantages in that it doesn't modify existing properties, and works.

This notification just came up.
Must have been a false positive. The method doesn't do what it says on the tin.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Luuk Vonk
Tera Guru

Please check the "sn_appclient.instance_type" system property for this information.

Just checked this, it's accurate now but has been incorrect for years (this is my dev instance).

JeffPatt_0-1729219170197.png