ere’s a quick tip that shows you how to retrieve the name or URL of your Service-now instance. This can come in handy if you need to construct a URL in a business rule or mail script or if you have some automated post-clone configuration when dealing with multiple Service-now instances in your environment.
Each instance has a property stored in the ‘sys_properties’ (System Properties) table that stores the name of your instance. The name of the property is (unsurprisingly) ‘instance_name’. You can find the value of this property via any server-side script (Business Rules, etc.) by using the ‘gs.getProperty’ method like this…
If you need to get the full URL for your instance you can get it from the ‘glide.servlet.uri’ property the same way…
Here’s a useful function that I’ve seen used before to create an html link for a specific record. All you need to do is pass in the table name and sys_id of the record and the function returns the html.
return "<a href=" + gs.getProperty('glide.servlet.uri') + gs.generateURL(strTableName, strSysID) + ">LINK</a>";