Setting the user-defined email and phone validation
- Select System Configuration > Dialog design.
- Select filter.
- Navigate to Dialog Layout.
- Right-click Properties and select Set User Defined Data..
-
Specify these user defined data:
Sample regex for email validation:
@ValidateFields={"RegEx": ["^(([^<>()\\[\\]\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$"],"ErrorMessage":"ValidationError_InvalidEmail" }
Note: You can modify the default regex according to your business needs.Sample format for phone validation:@FormatField={ "Format": ["+nnnnnnnnnnnn"] }
When creating a phone format, ensure that the number of characters complies with the number of characters required by M3. n represents the number between 0 to 9, while M3 validates the length depending on the number of n in the format. To create a phone format, you can also add a plus sign (+), left and right brackets (), or a dash (-). You can also add multiple phone formats by adding commas in between the phone formats as show in this example:
"Phone": {"Format": ["+(420)-nnn-nnn-nnnn",”+(nn)-nnn-nnn”]}
If the phone validation is based on a country, see the section on how to set up a code event in Code maintenance.