How can I check the current Service Portal name?

theBeastMaster
Mega Guru

If I open a record producer in Service Portal. while on the form, is it possible that I can check the name of my current service portal whether it is sp or some other portal?

I am using the producer redirect portal to navigate to a thank you page wherein I had to hardcode portal name but I do not want to do that.

6 REPLIES 6

Gowrisankar Sat
Tera Guru

You can get current portal from below URL:

https://<instance_name>.service-now.com/sp_portal_list.do?sysparm_query=default%3Dtrue&sysparm_first_row=1&sysparm_view=

You can add this code in RP script field to get the default SP Name:

var gr = new GlideRecord("sp_portal");

gr.addQuery("default=true");

gr.query();

if(gr.next())

var spurl = gr.url_suffix;

Use spurl variable in the URL building with producer.portal_redirect:

producer.portal_redirect = spurl+"?id=<id of thank you page>";

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

Did you try this:

this.location.href

thanks,

ashu