Based on condition both text and number needs to be accepted by the variable

suuriyas
Tera Contributor

HI Community,

 

I have a requirement, we have a variable which is single line text and Validation Regex is number so only numbers can be entered now based on some condition it needs to accept both text and number and for some condition that variable need to accept only number.

 

Is it possible can we achieve this?

Thanks in Advance

 
 
3 REPLIES 3

J Siva
Tera Sage

Hi @suuriyas 
In this scenario, use client script to do the validation.
Variable validation regex is not suitable for your requirement.

Regards,
Siva

Hristo Ivanov
Kilo Sage

You can't do that with regex, as J mentioned go with Client script to validate

Ankur Bawiskar
Tera Patron
Tera Patron

@suuriyas 

I agree with other members, please use regex using client script and handle regex only when required

what did you start with and where are you stuck?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader