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 M-Files variables can be used in the conditions: PropertyDef, PropertyValue, ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID. For more information about the variables, refer to VBScript Variables Explained.
The code below is used for checking that the property value specified contains 10 characters:
Option Explicit
DIM value
value = PropertyValue.GetValueAsUnlocalizedText
If Len(value) < 10 Then
Err.Raise MFScriptCancel, "The value you enter must be 10 characters long."
End If