- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 11:39 PM
Hi,
I have two fields. Field A and field B.
I want to make sure that the value entered in field A should not match the value in field B. I achieved this but i have a problem as it is case sensitive. Like if Filed B is- "Master" then field A is accepting value "master". I want it to be case insensitive and reject this value. Please help.
ServiceNow Community Rising Star 2022/2023
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 11:50 PM
You should use either toLowerCase or toUpperCase method to convert both values to the same case before comparing them.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 11:48 PM
Hi
Can you please share the script that you hav tried?
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 11:50 PM
You should use either toLowerCase or toUpperCase method to convert both values to the same case before comparing them.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2021 11:55 PM
Hi Jagjeet,
Please try this
var filed1 = g_form.getValue("field1").toLowerCase();
var filed2 = g_form.getValue("field2").toLowerCase();
if(field1==field2)
{
//your code if both fields values are same
}
else
{
return false;
}
Regards
Sk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2021 12:51 AM