|
| 1 | + |
1 | 2 | # Regular Expression on Catalog Client script |
2 | 3 |
|
3 | 4 | ***************** |
| 5 | + |
4 | 6 | 8th october: |
5 | | -This script will validate valid Adhaar number. |
6 | | -Adhaar is a 12 digit unique identification number issues by Unique Identification Authority of India (UIDAI) for Indian Residents. |
7 | | -The script will validate Adhaar through regex and if it is not valid, variable is cleared with field message. |
8 | | -For Catalog variables Preferred OOB method is listed here : https://www.servicenow.com/docs/bundle/xanadu-servicenow-platform/page/product/service-catalog-management/task/define-regex-vrble.html . The same regex can be defined in "Variable Validation Regex" module. |
9 | | -For Normal fields, this entire scriopt can be used. |
| 7 | + |
| 8 | +This script will validate the Adhaar number. |
| 9 | + |
| 10 | +Adhaar is a 12 digit unique identification number issued by the Unique Identification Authority of India (UIDAI) for Indian residents. |
| 11 | + |
| 12 | +The script will validate Adhaar through regex, and if it is not valid, the variable is cleared with a field message. |
| 13 | + |
| 14 | +The preferred OOB method for catalog variables is listed here : https://www.servicenow.com/docs/bundle/xanadu-servicenow-platform/page/product/service-catalog-management/task/define-regex-vrble.html . The same regex can be defined in "Variable Validation Regex" module. |
| 15 | + |
10 | 16 |
|
11 | 17 | Regex details : |
| 18 | + |
12 | 19 | /^[2-9][0-9]{3}[0-9]{4}[0-9]{4}$/ |
| 20 | + |
13 | 21 | // ^ → Start of the string |
| 22 | + |
14 | 23 | // [2-9] → The first digit must be between 2 and 9 |
| 24 | + |
15 | 25 | // [0-9]{3} → Followed by exactly 3 digits (0–9) |
| 26 | + |
16 | 27 | // [0-9]{4} → Followed by exactly 4 digits (0–9) |
| 28 | + |
17 | 29 | // [0-9]{4} → Followed by exactly 4 digits (0–9) |
| 30 | + |
18 | 31 | // $ → End of the string |
19 | 32 |
|
20 | 33 | ***************** |
21 | | -With the help of this code you can easily validate the input value from the user and if it's not a email format you can clear and throw a error message below the variable. Of course you can use Email type variable as well but you cannot have a formatted error message. |
22 | | - |
23 | | -* [Click here for script](script.js) |
24 | 34 |
|
| 35 | +With the help of this code, you can easily validate the input value from the user. If it is not an Adhaar, you can clear it and throw an error message below the variable. The same validation can be used for fields instead of variables. |
25 | 36 |
|
| 37 | +* [Click here for script](script.js) |
26 | 38 |
|
27 | 39 |
|
0 commit comments