Need code to find whether field contains text or integer

malaisamyj
Tera Contributor

Hi All,

I have a requirement where i have a string field in which i have written a business rule to calculate.

But i want specify condition saying that if the string field contains text it should not run the business rule.

Is it possible to get the value of field and differentiate whether its text or integer?

Thanks

Malaisamy

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

Please use isNaN() function to check if field contains number or not



JavaScript isNaN() Function


View solution in original post

6 REPLIES 6

antin_s
ServiceNow Employee
ServiceNow Employee

Hi Malaisamy,



Please check the following. It might help.



!isNaN(current. short_description)     //Replace short_description with your field name



find_real_file.png



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


Hi Malai,



In your case, you want to Run the Business Rule when it's a number so just remove the ! sign from the provided condition by Antin and it should work.