How to get the page name from URL? GlideTransaction URL always returning "/view_content.do"

Abhinandan Pati
Giga Guru

Hello Everyone,

I have two sites in my system & I want to block all the pages of first site to the user of second site. And if user tries to access first site then system should redirect the user to home page of the second site.

Now I am able to block all the pages of first site but because of this system is always redirecting the user to home page of the second site. What I mean is, if user tries to access pages of the second site, then also system is redirecting the user to the home page of the second site.

So to avoid this I am trying get the pages from the URL & if URL contains page of the second site then system should stop the redirection & it should move to that particular page.

I am trying to implement this using "GlideTransaction". Here is code snippet

  var transactionExt = GlideTransaction.get();

  gs.log("Transaction URL: "+transactionExt.URL);

  gs.log("Transaction URL String: "+transactionExt.URLString);

But "transactionExt.URL" is always returning "/view_content.do"[Transaction URL: /view_content.do] & because of this system is not able to find out the correct page & it is redirecting to home page.

From below discussion, I found out that there should be one record in the "Content Type" table but I am not clear on this.Do I need to create new record in 'content_type' table for every page?? And we have configured SAML 2.0 in our instance.So please guide me on this & if there is any other solution then please let me know.

CMS Search

Thanks

Abhinandan

1 REPLY 1

Joe Wilmoth
ServiceNow Employee
ServiceNow Employee

Hi Abhinandan,



You can just use ${current_page.getURLSuffix()} to grab the URL Suffix from a page in the CMS. You can also grab the URL with front-end JS by using decodeURIComponent(document.URL).



Thank you,