Auto populate field on Record Producer with URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 06:29 AM
Hi,
Is it possible to populate a field on a Record Producer with the URL the user came from?
We have a Sharepoint site with a button which redirect to a specific Record Producer, and I'm trying to get the HTTP header referrer to auto populate.
I've created a Catalog Client Scripts and tried to do a 'var referrer = document.referrer' but get the error message
"Cannot read property 'referrer' of null" in the browser console

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 06:40 AM
Hi,
Try below
var url = new GlideURL(top.window.location.href);
var test = GlideURL.getParam('paratmeter of the url you want to get');
g_form.setValue('your variable name', test);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 06:50 AM
Thanks for your answer!
The problem is that I don't know the parameters. The only thing I have is https://customer.sharepoint.com/sites/ and the rest changes.
Or have I misunderstood you?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 07:20 AM
Hi,
document.refferer returns the url which has loaded the document. If you want to auto-populate the fields on record producer. You need to open record producer with and pass the parameter like &name=a&email=b (you can do this on sharepoint button)and then using my code, you can get the value of name and email which you can use to set in variables.
The url for record producer would look something like below
https://instancename.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=b05edacb4f3523004b5c30318110c705&name=rahul&email=blah