- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 01:26 AM - edited ‎03-26-2025 01:32 AM
I have created mobile number variable on record producer and type is single line text, as of now letters and numbers both are allowing to enter, so I tried with Variable attributes - max_length=10
it is restricting length 10 but it is allowing both numbers and letters, also I tried to create question_regex record and added below code, but still it is allowing both and more than 10 as well
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 07:16 PM
Hi @suresh101 ,
yeah update the regex to ->
04\d{8}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 01:54 AM
mobile format will vary based on country, some countries have 9 digit
So if you don't want to check for particular format then simply use this regex shared by @Chaitanya ILCR for allowing only numbers and max 10 numbers
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2025 03:08 AM
Hello @suresh101
Use this - ^\d{10}$
As regex - it will accept only 10 digits from 0-9 and without space.
Obviously, you can also go for OOB variable type - phone number.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY