Fetching values from URL - Agent Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 12:38 AM
I have to fetch values from the URL (sc_req_item & sysID next to it) and set it in Table field "source_table" & Document ID field "source_record" on the form respectively.
Sample URL as follows:
I'm tried following method but not sure how to use it exactly.. I used the same method for UI16 and it worked as expected
var gURL = new GlideURL();
gURL.setFromCurrent();
- Labels:
-
Agent Workspace
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 01:01 AM
Hi Ram,
there might be some restrictions in client script in terms of how values from URL can be fetched
please refer below links for help
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 03:20 AM
Hi Ankur,
I referred the given links and used the below code.
var url = top.location.href;
alert(url);
I'm getting the URL. Thanks. But can you help me in getting the "sc_req_item" & sysID from the printed URL..
Best Regards,
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 03:42 AM
Hi Ram,
So you want source_record
Set UI Type as ALL
Can you try this
var url = top.location.href;
var comp1 = new URLSearchParams(url).get("source_record");
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 03:59 AM
Hi Ankur, It's giving me NULL.
var url = top.location.href;
alert(url);
var comp1 = new URLSearchParams(url).get("source_record");
alert(comp1);
Best Regards,
Ram