Restrict entire service portal to selected users.

scottl
Kilo Sage

I'm trying to restrict certain users from certain portals. Does anyone know how to achieve this, as I've looked into user criteria however one cannot use this functional at the portal level.   And ideally if the user doesn't have permission to this portal redirect them to   another portal.

And is user criteria for service portal only available to Jakarta?

https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/build/service-portal/concept/use...

9 REPLIES 9

So for the licensing - call your rep and ask. Never believe the posts and everybody's contract is different.



So script includes - SPEntryPage - controls redirection to Portal or desktop view.


In that script, we are checking for the User's country and if restricted, redirecting them to a different Portal named /sorry. That just had a page that says coming soon to your country. This would be all you need to redirect them, but it doesn't prevent them from changing the URL and getting to your real portal, hence the role.



var SPEntryPage = Class.create();



SPEntryPage.prototype = {


     


      initialize: function() {


              this.logVariables = false;   // for debugging


             


              var country = gs.getUser().getCountry();


              gs.log('User country '+country);


             


             


              //***Any changes to the list needs to be changed in onAfter LDAP transform map


             


              if (country == 'AT' || country == 'BE'){


                     


                      this.portal = "/sorry/";


              }


              else{


                      this.portal = "/sp/";


              }


      },


syed_faheem
ServiceNow Employee
ServiceNow Employee

Hi scottl, please have a look at Service Portal Separation & Redirection solution which i have developed for this purpose.


Cheers


Syed


I tried the same but url shows "www.xxxyy.service-now.com/undefined" ..in javascript executor am able to get the right service portal url suffix picked 

let me know what i am missing in sf.portal.redirect UI script.

 

Below is the script : 

function invokeRedirector(){
var portal=localStorage.getItem('custUrl');
var pageURI = window.location.toString();
var redPage="/portal_redirect.do";
var custUrl;
if(pageURI.indexOf('sp')==-1){
console.log('portal' +portal);
if(!portal){
localStorage.setItem("returnUrl", pageURI);
window.location=redPage;
}
else if(pageURI.indexOf("/"+portal+"?")==-1 &&
pageURI.substr(pageURI.length - portal.length)!=portal){
if(pageURI.indexOf('?')!=-1){
custUrl=portal+pageURI.substring(pageURI.indexOf('?'));
window.location="/"+custUrl;
}
else
{
custUrl=portal;
window.location="/"+custUrl;
}
}
}
}

@syed_faheem  Can you provide an updated link to your solution. The link here takes me to the Community home page.