Compare two field values

JagjeetSingh
Kilo Sage
Kilo Sage

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.

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023
1 ACCEPTED SOLUTION

Slava Savitsky
Giga Sage

You should use either toLowerCase or toUpperCase method to convert both values to the same case before comparing them.

View solution in original post

4 REPLIES 4

Murthy Ch
Giga Sage

Hi @Jagjeet Singh 

Can you please share the script that you hav tried?

 

Thanks,

Murthy

Thanks,
Murthy

Slava Savitsky
Giga Sage

You should use either toLowerCase or toUpperCase method to convert both values to the same case before comparing them.

sk8
Kilo Expert

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

Murthy Ch
Giga Sage

Hi @Jagjeet Singh 

find_real_file.png

 

Thanks,
Murthy