Way to add environment variable so that we can use everywhere like Rest Message Endpoint?

leemey
Kilo Contributor

hi developers,

I have added some Rest Messages in my SN instance. Sometimes I need to change the endpoint for the same rest message so I am wondering if there is a function in Service Now that I can store all my environment variables and used everywhere? I tried to search this and only get the information about add variable substitutions which can be only used inside the HTTP Method.

The Endpoint like: http://&{IPAddress}:9000/oauth2/token. We need to find a place to store this IPAddress which can influence all the rest messages.

Thanks,

Leemey

3 REPLIES 3

jarodm
Mega Guru

A system property sounds like what you're looking for.


Table: sys_properties


Set: gs.setProperty('property.name');


Get gs.getProperty('property.name');



Either this or a custom configuration/definition table if multiple simultaneous configs are needed (e.g. one for DEV, one for TEST, one for PROD).


leemey
Kilo Contributor

Thanks for your prompt reply Jarod, I tried to add system property and seems the HTTP Method Endpoint can't analysis gs.getProperty function. Please correct if my spelling or understanding is wrong.


System Property.pngHTTP Method.png


leemey
Kilo Contributor

Thanks for your prompt reply Jarod, I tried to add system property and seems the HTTP Method Endpoint can't analysis gs.getProperty function. Please correct if my spelling or understanding is wrong.


System Property.pngHTTP Method.png