- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 10:52 PM
HiTeam,
I need to read "sysparm_stack"from the URL "u_demo_view.do?sys_id=-1&sysparm_stack=abc"and hide the filed using Client script.
How we can Achieve this ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 10:57 PM
Hi @SandeepKSingh ,
Please have a look at the below community post -
https://www.servicenow.com/community/csm-forum/get-url-parameters-from-client-script/m-p/389334
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 11:01 PM
You can use the below onLoad Client script...
Your current URL is "u_demo_view.do?sys_id=-1&sysparm_stack=abc"
var currentURL = top.location.href;
var urlParams = new URLSearchParams(top.location.search);
var sysparm_stack = urlParams.get('sysparm_stack');
if (sysparm_stack === 'abc') {
g_form.setDisplay('yourfieldname', false);
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 10:57 PM
Hi @SandeepKSingh ,
Please have a look at the below community post -
https://www.servicenow.com/community/csm-forum/get-url-parameters-from-client-script/m-p/389334
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 11:01 PM
You can use the below onLoad Client script...
Your current URL is "u_demo_view.do?sys_id=-1&sysparm_stack=abc"
var currentURL = top.location.href;
var urlParams = new URLSearchParams(top.location.search);
var sysparm_stack = urlParams.get('sysparm_stack');
if (sysparm_stack === 'abc') {
g_form.setDisplay('yourfieldname', false);
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/