Available Event Handlers

Document vault event handlers

Below you can find the available event handlers, with their variables and explanations. For more information about variables, refer to VBScript Variables Explained.

BeforeSetProperties / AfterSetProperties

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, ObjVer, and PropertyValues

Execution:

The event handlers are executed when the property values of the object stored in the document vault are re-set.

BeforeCreateNewObjectFinalize / AfterCreateNewObjectFinalize

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, ObjVer, and PropertyValues

Execution:

The event handlers are executed when a new object is created in the document vault. When executing the AfterCreateNewObjectFinalize event handler, the object may already have been checked in. For this reason, the metadata or files can no longer be modified during operation of the event handler.

BeforeCancelCreateObject / AfterCancelCreateObject

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when an object which has never been checked in is removed from the document vault. The execution takes place, e.g., when the user performs the "Undo Checkout" function on the object or removes the object from the document vault.

BeforeCheckInChanges / AfterCheckInChanges

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when the user checks the object in. The event handlers are not executed if the object was not modified, in which case the BeforeCancelCheckOut and AfterCancelCheckOut event handlers are executed. During execution of the AfterCheckInChanges event handlers, the object can no longer be modified as the object has been checked in.

BeforeCheckOut / AfterCheckOut

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when a document vault object is checked out. During execution of the BeforeCheckOut event handler, the object has not been checked out, so the object cannot be modified.

BeforeCancelCheckOut / AfterCancelCheckOut

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when modifications of a checked out object are undone using, e.g., the "Undo Checkout" function. The event handlers are also executed if the object is checked in without any modifications. During execution of the AfterCancelCheckOut event handlers, the object cannot be modified as the object is no longer checked out.

BeforeDeleteObject / AfterDeleteObject

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when an object is marked as deleted.

BeforeDestroyObject / AfterDestroyObject

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when an object is destroyed from the document vault.

BeforeDestroyObjectVersion / AfterDestroyObjectVersion

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, and ObjVer

Execution:

The event handlers are executed when an individual version of the object is destroyed from the document vault.

BeforeSetObjectPermissions / AfterSetObjectPermissions

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, DisplayID, ObjVer, and ObjectAccessControlList

Execution:

The event handlers are executed when the object permissions are changed.

BeforeFileUpload

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, and FileTransferSessionID

Execution:

The event handlers are executed when the user starts file transfer to the M-Files Server.

AfterFileUpload

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, FileTransferSessionID, and FileVer

Execution:

The event handlers are executed when the file transfer to the server is completed.

BeforeFileDownload / AfterFileDownload

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, FileTransferSessionID, and FileVer

Execution:

The event handlers are executed when the user loads the file from the M-Files Server to the client machine's local cache. If necessary, these event handlers can be used to prevent transfer of certain files to the users' machines.

BeforeCreateNewValueListItem / AfterCreateNewValueListItem

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, and ValueListItem.

Execution:

The event handlers are executed when new values are added to a certain value list of the document vault. These event handlers can be used to, e.g., ensure that all values entered in the value list are in a specified form as desired.

BeforeLoginToVault

Variables: VaultSharedVariables, MFScriptCancel, Vault, and LoginAccount

Execution:

The event handler is executed immediately prior to logging in of the user to the document vault. At this stage, the user has already been identified against the M-Files Server, so the event handler is not executed, e.g., if a user who attempts to log in does not have a login account on the server.

AfterLoginToVault

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, Vault, and LoginAccount

Execution:

The event handler is executed when the user has successfully logged in to the document vault.

BeforeLogoutFromVault

Variables: VaultSharedVariables, MFScriptCancel, CurrentUserID, and Vault

Execution:

The event handler is executed immediately before the user is logged out of the document vault. The logout cannot be interrupted during this event handler. The client software does not react to any error messages received from this event handler.

AfterLogoutFromVault

Variables: VaultSharedVariables, MFScriptCancel, Vault, and LoggedOutUserID

Execution:

The event handler is executed when the user has been logged out of the document vault. The logout cannot be interrupted during this event handler. The client software does not react to any error messages received from this event handler.

Replication: AfterCheckInChanges

Variables: VaultSharedVariables, MFScriptCancel, Vault, RestoredVersions, and ObjVer

Execution:

The event handlers are invoked when new versions are imported to the existing object from the content package or when a conflict between two objects is resolved in favor of the source-vault version. When the AfterCheckInChanges event handler is invoked, the object has already been checked in. For this reason, the metadata or files can no longer be modified during operation of the event handler.

Replication: AfterCreateNewObjectFinalize

Variables: VaultSharedVariables, MFScriptCancel, Vault, and LoggedOutUserID

Execution:

The event handlers are invoked when a new object is imported to the document vault from the content package. On invoking of the AfterCreateNewObjectFinalize event handler, the object has already been checked in. For this reason, the metadata or files can no longer be modified during operation of the event handler.

Server event handlers

BeforeRunScheduledJob / AfterRunScheduledJob

Variables: MFScriptCancel, CurrentUserID, ScheduledJob, and ScheduledJobOutputInfo

Execution:

The event handler is executed when one of the timed jobs of the server is performed. These event handlers can be used to automatically monitor the execution of the automatically timed jobs. In case of error, the event handler can automatically send an e-mail notification to the administrator to facilitate resolution of the problem.