Based on condition both text and number needs to be accepted by the variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 11:31 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 11:36 PM
Hi @suuriyas
In this scenario, use client script to do the validation.
Variable validation regex is not suitable for your requirement.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 11:44 PM
You can't do that with regex, as J mentioned go with Client script to validate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 12:06 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader