Setting up code event
To validate a data from a dropdown selection, you must set up the event parameter in code event and map it to the code group.
- Select Code maintenance > Code event.
- Click New.
- Specify this information:
- Description
- Provide a description for the code event.
- CodeGroup
- Specify a name for the code group.
- Usable
- Select the option if the validation defined is used.
- Under Event parameter, specify the event parameter for the code group.
Here are some samples of event parameters:
Event parameter Format Sample Regex email validation "<FieldName>": {"RegEx": "<RegularExpression>", "ErrorMessage": "<StringKey>"}
{"CommunicationText" : {"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"}}
Format "<FieldName>": {"Format": ["<FieldFormat>”]}
{"Phone”: {"Format": ["+01-nnn-nnn-nnnn"]}}
{"Phone”: {"Format”: ["+(420)-nnn-nnn-nnnn",”+(nn)-nnn-nnn”]}}
Note:<FieldName>
must be replaced with the correct field.<RegularExpression>
must be replaced accordingly to your business needs.<StringKey>
to be used must not have a parameterized message.For<FieldFormat>:
-
Ensure that the number of characters complies with the number of characters required by M3.
-
Use n to represent each numeric placeholder where you need a digit (0 to 9). Confirm that the number of n characters matches the required length for that field
-
Use a plus sign (+), parentheses (), or a dash (-) to format these fields, if appropriate for clarity and compliance with system requirements.
-
If there are multiple field format defined, no placeholder will be displayed on the field.
The format validation only take effect on fields set as SingleLineTextBox.
-
- Click Save.