Anyone know how to get current instance in the Service Portal?

tstocking
Tera Guru

Looking for a way to get the current ServiceNow instance from the Server Side or Client Side in a Service Portal widget.   We are building a mailto link and I want to grab the instance name and url for use with the mail to.   Only way I can think of now is to query the sys_properties table.   Example:

// Get the Instance Name

var gr = new GlideRecord('sys_properties');

gr.addQuery('name','instance_name');

gr.query();

if (gr.next()){

  data.instance = gr.value.getDisplayValue();

}

1 ACCEPTED SOLUTION

dvp
Mega Sage
Mega Sage


Did you try


gs.getProperty('instance_name');


View solution in original post

2 REPLIES 2

dvp
Mega Sage
Mega Sage


Did you try


gs.getProperty('instance_name');


I swear I tried that before and it wasn't working.   Thanks.