- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 02:25 AM
Hi Team,
We have a requirement to make a variable in phone number format. Request you to please help in getting the script for it.
Thanks in advance,
Abhishek
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 04:11 AM
Hi,
no client script required
You can create variable validation Regex and then attach it to the Variable
Validate U.S Phone Numbers using JavaScript Regular expression.
This will work for these phone number formats
E.g (308)-135-7895 or 308-135-7895 or 308135-7895 or 3081357895
^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 02:31 AM
Hi,
there can be different formats like US phone number, India phone number
you can check with customer which exact format they require and based on that use Regex and use variable validation regex to achieve this
sharing links for help
Validation for number for variable in Catalog item
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 03:13 AM
Hi
It should be Us number validation only, Could you please provide the client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 04:11 AM
Hi,
no client script required
You can create variable validation Regex and then attach it to the Variable
Validate U.S Phone Numbers using JavaScript Regular expression.
This will work for these phone number formats
E.g (308)-135-7895 or 308-135-7895 or 308135-7895 or 3081357895
^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader