How do i make a ui page to redirect to other pages based on conditions

Ryan Norton
Giga Contributor

Basicly what im trying to do is change the logon page so that users within a specific known ip range go to our sso page and other users go to the side door logon page.

1 ACCEPTED SOLUTION

I will preface my statement with the comment that we do not use public pages - we keep all our content secured.



My understanding is that you can use a public Page from a Content Site. This public Page will contain a dynamic content block, and that dynamic content block can contain Javascript (and other languages). Because you have the ability to use Javascript within your dynamic content block you can go ahead and do whatever you want to do.



For example, I created this public page (at least I sure hope I did) on a demo instance:


ServiceNow



When you go into the code you will see the simple content of my dynamic block:


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


Test public page


  <script>


  alert("Test");


  </script>


  <g:evaluate>


  var test123 = "test123";


  test123 = gs.getSession().getClientIP().toString();


  </g:evaluate>


  <br/><br/>Your IP is: ${test123}


</j:jelly>



So when you navigate to the public page it loads some text ("Test public page"), has a popup, then displays your IP. You can put whatever Javascript or Jelly you want in there - I have just provided two basic examples.



Hopefully that helps you get started? It shows you how to create a public page (Making a Page Public - ServiceNow Wiki , how to create a dynamic block to utilize Jelly and Javascript, and how to display the IP. You can then just code in the logic you want based on the IP.




I know ServiceNow had Login Rules in the past and such, it might be worth exploring whether they have something built in to do this. We have no need, so I never explored it.



As well, I see you are in Edmonton as well - you can always talk to Jamie (one of your local SN tech guys) and have him help you out too!


View solution in original post

5 REPLIES 5

Sure - I think I captured everything in this one.



Just remember - it WILL make a public page on the instance you load it on and it WILL enable the Public Pages module in your left hand nav (it is hidden by default).