how to get current url and check using getUrlOnStack() ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2019 07:44 AM
Hello guys,
can some one please help me how to check the current url and then redirect base on that to a specific view.
getUrlOnStack()
If the user opening an RITM has no itil roles, and the requested item is from the Software Catalog, and the item is being opened from an /SSS portal url and the item is not closed incomplete, use the sp view.
Script:
if (!gs.hasRole("itil") && item.sc_catalogs=="57bf1d3e13635b00602dbcaf3244b0a0" && state!="4");
view =sp;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2019 08:28 AM
Where are you running this from? If it's server side you may be able to use something like RP.getReferringURL.
Also, this post may be helpful: https://community.servicenow.com/community?id=community_question&sys_id=67240729dbd8dbc01dcaf3231f96...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2019 08:33 AM
Thanks Brad,,
I am checking in view rules (advance ) , we have a requirement where if the logged in user is opening the RITM from portal he should be redirected to sp view
https://xyz.service-now.com/sss is my portal link , can you please let me know to to add this in below query ?
if (!gs.hasRole("itil") && item.sc_catalogs=="57bf1d3e13635b00602dbcaf3244b0a0" && state!="4");
view =sp;
and in view rules can we check if the opened RITM is from certain catalog or not ?
-------------------------------------
can we check roles and conditions at the same time in the view rules ?