Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Get instance name of service now (dev v prod) via script

brantgluth
Kilo Expert

Looking to avoid hard coding debug variables and passing them amongst sub-workflows.

Were I doing standard web development w/ JavaScript, I'd do something like

var isDebug

var host = window.location.hostname;

isDebug = host.includes('dev');

Is there a way to do something similar within ServiceNow/Orchestration?

1 ACCEPTED SOLUTION

HugoFirst
Kilo Sage

There is a system property named "instance_name" which you can reference from your script.



Here's a link explaining how to get a system property from a server side script.


http://wiki.servicenow.com/index.php?title=GlideSystem#getProperty.28String.2C_Object.29  


View solution in original post

2 REPLIES 2

HugoFirst
Kilo Sage

There is a system property named "instance_name" which you can reference from your script.



Here's a link explaining how to get a system property from a server side script.


http://wiki.servicenow.com/index.php?title=GlideSystem#getProperty.28String.2C_Object.29  


Perfect. Recently added to devel by work to the system, working out my


SNLegs and where everything is. From that i was able to figure out



var thisInstanceName = gs.getProperty("instance_name");



Thank you for alleviating some hardcoding for me



On Mon, Oct 31, 2016 at 10:32 AM, HugoFirst <