How to get URL params in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2018 11:56 PM
Hello,
i need to get URL parameter in script include.this script include will trigger by variables reference qualifier.
i didn't find the solution to get params in script include.Please help me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2018 04:34 AM
This should be quite straightforward. Try setting your reference qualifier to something like this:
javascript:new MyScriptInclude().methodName(gs.action.getGlideURI().toString());
Your Script Include will look something like this:
var MyScriptInclude = Class.create();
MyScriptInclude.prototype = Object.extendsObject(AbstractAjaxProcessor, {
methodName: function(parm) {
gs.addInfoMessage(parm); // Display the URL parameter to check it works
// Insert logic here to process 'parm' and create a dynamic query
return "active=true"; // Return an encoded query string
},
type: 'MyScriptInclude'
});
Let me know if this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2018 06:51 PM
thank u for ur reply,
i have tried that given code. by this code url is coming like this
angular.do?sysparm_type=sp_ref_list_data
but my actual service portal url is
https://dev16236.service-now.com/sp?id=sc_cat_item&sys_id=0061c4274f105300b4787bb28110c736
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2019 05:41 AM
Hi,
I am also working on the same issue, can you help me out on this if you find any solution.
Thanks,
Manideep Nadimpelli.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2019 05:20 AM
In Client side use : "window.location.href" or "document.URL"
In Server side use: gs.getProperty("glide.servlet.uri")+gs.action.getGlideURI()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2022 01:02 AM
Hi,
This is can be done by creating a variable on the catalog/record producer / table and hide it on form.
Create a onload client script and pass the url to the created variable. (top.location.href)
var url = top.location.href;
g_form.setValue('variablename', url);
Then pass the variable value to the reference Qualifier like new ScriptInclude().MethodName(current.variablename)