How can my script determine the version of ServiceNow that is running?

esbensen
Kilo Explorer

As the title says ... we use the Table API extensively and need a way to programmatically determine the ServiceNow version (we are running both Eureka and Fuji in different environments).   Any ideas?

8 REPLIES 8

Mike Allen
Mega Sage

There is an InstanceInfo.do?WSDL that you can query to get your version.   You can look at it in your Scripted Web Services module.


This sounds like the way to go but for some reason, I can't get a response from that SOAP endpoint.   I haven't used these scripted web services before so I'm probably missing something.


>>> from suds.client import Client
>>> url = 'REDACTED'
>>> client = Client(url)
>>> print str(client.service.execute())
None

I just do it through soapUI:



Capture.PNG


The SN Nerd
Giga Sage
Giga Sage

There is probably a better way, but this comes to mind.



If your instance has been upgraded at least once, you could query the upgrade history table as follows:



var gr = new GlideRecord('sys_upgrade_history');


gr.addEncodedQuery('from_version!=n/a');


gr.setLimit('1');


gr.orderByDesc('upgrade_finished');


gr.query();


if (gr.next()) {


        gs.print(gr.to_version);


}



Alternatively, you could parse the stats.do page for the build details.



Build name: HEAD (Fuji)


Build date: 05-14-2015_0900


Build tag: glide-fuji-12-23-2014__patch4-05-06-2015



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