- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2020 11:57 PM
Hi All,
Can we get certain values in script include from the url that is generated in lookup.
For eg: If the url coming on clicking the lookup:
https://dev87573.service-now.com/sys_user_list.do?sysparm_target=sc_req_item.request.requested_for&sysparm_target_value=&sysparm_reference_value=&sysparm_nameofstack=reflist&sysparm_clear_stack=true&sysparm_element=requested_for&sysparm_reference=sys_user&sysparm_view=sys_ref_list&sysparm_additional_qual=&sysparm_client_record=session
If I want the value of sysparm_target. Can we get it in script include or any BR?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 12:07 AM
Hi
You need to access the URL in your client script and then pass it to the SI. Here is a link that can help you.
Kindly mark the comment as a correct answer and also helpful if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 03:01 AM
Hi Ankur,
Thanks for the response!
i tried giving the above but not getting the expected value.
I have created a filter(sys_filter) on user table. From this filter i am calling a script include.
var GetValues = Class.create();
GetValues.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getVal: function() {
var value = gs.action.getGlideURI().getMap().get("sysparm_target");
gs.log("Calling from filters ");
gs.log("Calling from filters value" + value);
}
I am getting the first log but second is not coming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 03:48 AM
what you got in logs for the url?
please print this
var url = gs.action.getGlideURI().toString();
gs.info('url' + url);
var value = gs.action.getGlideURI().getMap().get("sysparm_target");
gs.log("Calling from filters ");
gs.log("Calling from filters value" + value);
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
‎09-03-2020 05:07 AM
I am not getting anything in log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2020 05:49 AM
So does it mean the function is not getting called?
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
‎09-03-2020 05:12 AM
Hi,
You cannot capture the url of the lookup using gs.action.getGlideURI() use client script as i suggested above, read and then pass that value to the SI.