Get URL in Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 07:28 AM
Hi,
in Agent Workspace I created a Related List Action implemented as Server Script.
I wolud like to get the URL. I tried with gs.action.getGlideURI() and I recieved this string: api/now/v1/batch?api=api, but I need to recieve the URL string like this: /now/workspace/agent/record/rm_release/3b682b1bdbc2d850ceb3ef08489619aa.
How can I do that?
Thanks in advance
Maddalena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 11:19 PM
Unfortunately, No. 😞
ServiceNow Community Rising Star 2022/2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2023 02:33 AM
Try using:
GlideTransaction.get().getRequest().getHeader("Referer")
This prints out the entire URL, and works on the workspace as well as "normal" view. I used this to figure out which page I was on for a before query business rule.
I'm not sure if this works in a scoped app, but it worked for me running in a Global business rule on Utah
Found this code being used in the global.InteractionRelationshipUtil script include, in the getParentInteractionSysId method
/**
* Utility to fetch sys_id of parent interaction record by using URL in request
*/
getParentInteractionSysId: function(){
var txn = GlideTransaction.get();
if (!txn)
return;
var request = txn.getRequest();
if (!request)
return;
var referer = request.getHeader("Referer");
if (GlideStringUtil.nil(referer))
return;
var matches = referer.match(/\/(agent|sow)\/(chat|record\/interaction)\/([0-9a-f]{32})/);
if (!matches || matches.length < 4)
return;
return matches[3];
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 06:57 AM
This works, we needed to show a UI Action in configurable workspace, but hide it from Agent Workspace and the only way we could figure out how to do that was by evaluating the URL.