How Can I Redirect Users to the Page They Were on After Login

sharepointau
Giga Guru

After we upgraded to London our users started being redirected back to the Service Portal home page when logging in from Catalog items, or other pages within the portal. 

This is less than ideal and many of our users are now complaining. 

However, I have been through several articles, documentation and videos and made several attempts to correct this. I am finding nothing in our setup that would have broken this. It appears that it should work, but I am not having any luck.

- SPEntryPage appears good
- glide.entry.first.page.script is set to "new SPEntryPage().getFirstPageURL()"

Any assistance is much appreciated. 

Version: London
Authentication: Central Authentication System (CAS) which uses SAML

1 ACCEPTED SOLUTION

Thank you for your reply. The answer was actually pretty simple. 

Because everything was correct on the back end per several articles on this forum, and docs.servicenow.com I focused on the Login Button in the header.

This is JS I ended up with that provided the desired outcome (returning the user to the page where they logged in as opposed to the Service Portal homepage)

var c = this;     
    $scope.openLogin = function () {            
    if (!c.data.is_logged_in) { 
            c.server.get({ 
                action: "set_sso_destination",  
                pageURI: $window.location.href
        }).then(function() { 
        window.location = "/login_with_sso.do"; 
    }); 

View solution in original post

5 REPLIES 5

asifnoor
Kilo Patron

Hi,

Look at login rules and Installation Exists. you can place your code anywhere for redirection in these 2 place as they both execute after login.

Ref: https://community.servicenow.com/community?id=community_blog&sys_id=0a3daae5dbd0dbc01dcaf3231f9619fa

Mark the comment as a correct answer and helpful once worked.

Thank you for your reply. The answer was actually pretty simple. 

Because everything was correct on the back end per several articles on this forum, and docs.servicenow.com I focused on the Login Button in the header.

This is JS I ended up with that provided the desired outcome (returning the user to the page where they logged in as opposed to the Service Portal homepage)

var c = this;     
    $scope.openLogin = function () {            
    if (!c.data.is_logged_in) { 
            c.server.get({ 
                action: "set_sso_destination",  
                pageURI: $window.location.href
        }).then(function() { 
        window.location = "/login_with_sso.do"; 
    }); 

Great, it helps.

Kindly mark the comment as helpful if it has helped you to solve the problem.

But login rules do not affect the service portal.