How to access a record's URL in UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 10:33 AM
We have a requirement of conditional logic in a UI Action. I'm trying to pass in the application state via a custom query parameter in the record's URL. For example the portalmode parameter below: (blahs in place of sys id)
/sysapproval_approver.do?portalmode=yes&sysparm_view=ess&sys_id=blahblah
However when I use gs.action.getGlideURI() (following this solution https://servicenow-pub.hosted.jivesoftware.com/thread/222681 ) in the UI Action script, the string I get back does not match the parameters I passed to the record. I'm getting back sysparm_tiny=blahblahblah
What am I doing wrong? Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 10:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 10:43 AM
THanks for the link. However that article doesn't cover the use case I'm inquiring.
I want to pass in some arbitrary parameter when loading a record. This arbitrary parameter is not necessarily an actual field on the record I'm loading. I would like for the UI Action script to be able to check for that parameter's value so I can execute conditional code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 11:00 AM
Hi Yang,
Here's something to try...
var uri = action.getGlideURI();
var map = uri.getMap();
map contains an object full of details on the record, including URI parameters (e.g. sysparm_view=ess).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 11:01 AM
It would appear that your URL with parameters was longer than the property glide.tiny_url_min_length specified and so a tiny URL was generated and that's what you have access to. You could test this by increasing the value of glide.tiny_url_min_length or by setting glide.use_tiny_urls to false and see if you can get properties from the URL. Hopefully this gets you closer to a solution.