How can I check the current Service Portal name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 05:18 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 05:47 AM
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>";

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 08:44 AM
Hi,
Did you try this:
this.location.href
thanks,
ashu