- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 05:23 AM
We make our support page by the Record Producer.
I want to set a different default value to a Variable per URL-parameter.
It is possible to judge a URL-parameter in a Catalog Client Script. But I need that in server-side(=Variable's Default Value).
It seems that it was possible before, but is it possible to implement it now?
Please tell me how if possible.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 05:27 AM
Hi @iwasaki
Please try below code in Default Value:
javascript: gs.action.getGlideURI().getMap().get('sysparm_aparameter'); // 'sysparm_aparameter' will be replaced by your URL parameter
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 05:27 AM
Hi @iwasaki
Please try below code in Default Value:
javascript: gs.action.getGlideURI().getMap().get('sysparm_aparameter'); // 'sysparm_aparameter' will be replaced by your URL parameter
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 06:14 PM
Thank you for your reply. I appreciate it very much😀
I have able to get a URL-parameter by that script.
(But I don't use "getMap()"... gs.action.getGlideURI().get("parameter");)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 05:58 AM
you can use gs.action.getGlideURI() in default value using script but I would suggest to use onLoad client script and get the url parameter value and then set the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2022 06:25 PM
Thank you for your reply.
I have able to get a URL-parameter by using "gs.action.getGlideURI().get()".
I would suggest to use onLoad client script
I wish I could in onLoad. But the target Variable has onChange.
Because I don't want the onChange to work, I wanted to implement it on the server side.