Validation

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

Note: Instructions for writing the VBScript code is not included in M-Files or M-Files API documentation. The documentation for the M-Files API is installed in the folder Start / Programs / M-Files / Documentation / M-Files API. For more information about VBScript code and M-Files API, contact [email protected]. Instructions on writing VBScript code and working with the M-Files API are available from the M-Files technical support staff for a separate fee.