Using document.URL within a Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2015 07:13 AM
I'm fairly new to servicenow scripts, however I'm looking into extracting the current URL via a business rule.
I've noticed var instanceURL = gs.getProperty("glide.servlet.uri") will return the instance URL, however it does not return the current URL that I'm seeing.
I've tried utilizing document.URL; but noticed that does not work (returns with an error).
Would there be another method for extracting the current URL within a Business Rule script?
Thanks in advanced.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2015 07:25 AM
Hi Joseph,
This will give you the instance URL -> gs.getProperty("glide.servlet.uri")
And this will give you the rest -> gs.action.getGlideURI()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2015 07:56 AM
Hi Anurag,
Thanks for the help.
Looking farther into this, it appears the URL that I'm attempting to grab is a reverse URL (reverse proxy).
So for example instead of seeing :
http://foo.service-now.com for the URL
I'm seeing
http://foo.bar.com for the URL
it seems that gs.getProperty("glide.servlet.uri") returns the first URL rather than the latter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2015 08:46 AM
Yes Joseph,
gs.getProperty("glide.servlet.uri") returns the first URL and gs.action.getGlideURI() will return the latter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2015 08:49 AM
It seems that the return of gs.action.getGlideURI() returns something along the lines of:
view_content.do?sysparm_stack ... etc
rather than:
perhaps this could be different from system to system?