- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 05:22 AM
I need to push field as mandatory based on the ui view . So i want to make the validation based on URL using window.location.href.contains(). So if the url belongs to second UI page then make field as mandatory? But i am trying its not working ! so can any expert help
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 02:22 AM
Would you mind marking my response as correct & helpful if I am able to resolve your query?
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
07-06-2020 05:26 AM
Hi,
Can you try below code to fetch it. I am just pasting one example.
var gUrl = new GlideURL();
gUrl.setFromCurrent();
var comments = gUrl.getParam("sysparm_comments");
OR
Thanks,
Ashutosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 08:37 AM
should i use this code in BR?CS?SI?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 09:44 AM
HI,
Client script.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 05:27 AM
Can you try this as well:
if (window.location.href.indexOf("franky") > -1) {
alert("your url contains the name franky");
}