Mobile number limit

suresh101
Tera Contributor

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

 

suresh101_0-1742977521341.png

 

1 ACCEPTED SOLUTION

Hi @suresh101 ,

yeah update the regex to -> 

04\d{8}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

6 REPLIES 6

Chaitanya ILCR
Mega Patron

Hi @suresh101 ,

Try this out

ChaitanyaILCR_0-1742978373059.png

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Thank you @Chaitanya ILCR 

it should start from 04 only, is it possible to do in regex

Hi @suresh101 ,

yeah update the regex to -> 

04\d{8}

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Community Alums
Not applicable

Hi @suresh101 ,

Out-of-the-box there exists a field type "Phone Number (E164)" that can be used to validate phone number formats. 

You can refer to the scripts mentioned in these threads :

https://www.servicenow.com/community/developer-forum/need-to-limit-to-10-digit-number/m-p/1373386

 

https://www.servicenow.com/community/developer-forum/how-to-set-a-phone-number-on-record-producer/m-...