Metadata Structure / Property Definitions |
On the Validation tab you can define the criteria that the property values should meet. For example, you can validate that the property value contains the specified number of characters. In this way, you can check that the customer's phone number or invoice number is added correctly to the object. You can also validate that, for instance, the value can be accepted in relation to other properties or that the value is not empty.
The validation is specified by using variables, generic features of VBScript, and M-Files API. The following variables can be used in the conditions: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, ObjVer, PropertyDef and PropertyValue. For more information about variables, refer to VBScript Variables Explained.
Sample code
The code below is used for checking that the property value specified contains 10 characters:
Option Explicit
value = PropertyValue.GetValueAsUnlocalizedText
If Len(value) < 10 Then
Err.Raise MFScriptCancel, "The value you enter must be 10 characters long."
End If