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 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.

Sample code

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

Note: The documentation for the M-Files API is located in Start > Programs > M-Files > Documentation > M-Files API. For more information about VBScript code and M-Files API, go to www.m-files.com/api. Instructions on writing VBScript code and working with the M-Files API are available for a separate fee from M-Files customer support ([email protected]).