Available Event Handlers

Note: This content is no longer updated. For the latest content, please go to the user guide for M-Files Online. For information on the supported product versions, refer to our lifecycle policy.

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

Vault-level event handlers

The event handlers listed in this section are triggered by operations on the vault level.

Note: An exception in an event handler prevents the triggering operation from being executed.
Event handler Variables Execution

BeforeSetProperties

AfterSetProperties

The event handlers are executed when the property values of the object stored in the document vault are re-set. Properties can be inspected during BeforeSetProperties before they are set. It is not, however, recommended to modify properties during BeforeSetProperties as they may be overwritten after the event handler has been executed. Properties, on the other hand, can be modified during the AfterSetProperties event.

BeforeCreateNewObjectFinalize

AfterCreateNewObjectFinalize

The event handlers are executed when a new object is created in the document vault, regardless of whether the new object has been checked in or not. When executing the AfterCreateNewObjectFinalize event handler, the object may have already been checked in. For this reason, the metadata or files can no longer be modified during operation of the event handler, and thus the event handler is only suitable for validating changes.

BeforeCancelCreateObject

AfterCancelCreateObject

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

BeforeCheckInChanges

AfterCheckInChanges

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. It is still possible to modify the object during BeforeCheckInChanges. These event handlers are also executed when the user creates a new object with the Check in immediately option unchecked, and checks in the object without making any changes to the file. These event handlers are not executed when a new object is created with the Check in immediately option enabled. During the execution of the AfterCheckInChanges event handler, the object can no longer be modified as the object has already been checked in, and thus the event handler is only suitable for validating changes.

BeforeCancelCheckOut

AfterCancelCheckOut

The event handlers are executed when modifications of a checked out object are undone using, for example, 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 handler, the object cannot be modified as the object is no longer checked out.

AfterCancelCheckoutFinalize

An event triggered after the undo checkout operation is complete, meaning that the object is no longer checked out. A script can be used for performing the checkout operation and for performing further object operations with the checked out object version.

BeforeCheckOut

AfterCheckOut

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.

BeforeDeleteObject

AfterDeleteObject

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

BeforeDestroyObject

AfterDestroyObject

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

BeforeDestroyObjectVersion

AfterDestroyObjectVersion

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

BeforeSetObjectPermissions

AfterSetObjectPermissions

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

BeforeFileUpload

The event handler is executed when the user starts a file transfer to M-Files Server.

AfterFileUpload

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

BeforeFileDownload

AfterFileDownload

The event handlers are executed when the user loads the file from 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

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, for example, ensure that all values entered in the value list are in a specified form as desired.

BeforeLoginToVault

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 M-Files Server, so the event handler is not executed, for instance, if a user who attempts to log in does not have a login account on the server.

AfterLoginToVault

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

BeforeLogoutFromVault

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

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

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

The event handler is 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.

VaultExtensionMethod

The event handler is invoked explicitly by the client (the so-called vault extension method).

The developer of the vault extension method must make sure that the user can be allowed to execute the method. In other words, the method should check the identity of the calling user and terminate if they do not have the required administrative rights in the vault.

BeforeCreateLoginAccount

AfterCreateLoginAccount

BeforeCreateLoginAccount: The event is triggered before a vault-level login account is created in the vault database.

AfterCreateLoginAccount: The event is triggered after a vault-level login account is created in the vault database.

BeforeModifyLoginAccount

AfterModifyLoginAccount

BeforeModifyLoginAccount: The event is triggered before a vault-level login account is modified in the vault database.

AfterModifyLoginAccount: The event is triggered after a vault-level login account is modified in the vault database.

BeforeRemoveLoginAccount

AfterRemoveLoginAccount

BeforeRemoveLoginAccount: The event is triggered before a vault-level login account is removed from the vault database.

AfterRemoveLoginAccount: The event is triggered after a vault-level login account is removed from the vault database.

BeforeCreateUserAccount

AfterCreateUserAccount

BeforeCreateUserAccount: The event is triggered before a user account is created in the vault database.

AfterCreateUserAccount: The event is triggered after a user account is created in the vault database.

BeforeModifyUserAccount

AfterModifyUserAccount

BeforeModifyUserAccount: The event is triggered before a user account is modified in the vault database.

AfterModifyUserAccount: The event is triggered after a user account is modified in the vault database.

BeforeRemoveUserAccount

AfterRemoveUserAccount

BeforeRemoveUserAccount: The event is triggered before a user account is removed from the vault database.

AfterRemoveUserAccount: The event is triggered after a user account is removed from the vault database.

BeforeCreateUserGroup

AfterCreateUserGroup

BeforeCreateUserGroup: The event is triggered before a user group is created in the vault database.

AfterCreateUserGroup: The event is triggered after a user group is created in the vault database.

BeforeModifyUserGroup

AfterModifyUserGroup

BeforeModifyUserGroup: The event is triggered before a user group is modified in the vault database.

AfterModifyUserGroup: The event is triggered after a user group is modified in the vault database.

Note: The AfterModifyUserGroup event handler is not executed when the All internal users group is modified.

BeforeRemoveUserGroup

AfterRemoveUserGroup

BeforeRemoveUserGroup: The event is triggered before a user group is removed from the vault database.

AfterRemoveUserGroup: The event is triggered after a user group is removed from the vault database.

AfterBringOnline

BeforeTakeOffline

AfterBringOnline: The event is triggered after the vault is brought online.

BeforeTakeOffline: The event is executed before the vault is taken offline. An exception in any of the two event handlers does not prevent the online/offline transition.

AfterCheckInChangesFinalize

The event is triggered when an object has been completely checked in (or when an object is immediately checked in after it has been created) after all the operations occurring after the check-in, such as any automatic state transitions, have been completed.

BeforeCreateView

AfterCreateView

BeforeCreateView: The event is triggered before a new view is created in a vault.

AfterCreateView: The event is triggered after a new view has been created in a vault.

BeforeModifyView

AfterModifyView

BeforeModifyView: The event is triggered before changes made to a view become effective.

AfterModifyView: The event is triggered after changes made to a view have become effective.

BeforeDeleteView

AfterDeleteView

BeforeDeleteView: The event is triggered before a view that is set to be deleted is actually deleted.

AfterDeleteView: The event is triggered after a view has been deleted.

BeforeReturnView

This event handler is triggered after a view has been retrieved from the vault but before it is returned to the client. It enables you to modify a view, for instance, by filtering it with dynamic search conditions, such as ones based on the current user.

BeforeUndeleteObject

AfterUndeleteObject

BeforeUndeleteObject: The event handler is triggered before an object is undeleted.

AfterUndeleteObject: The event handler is triggered after an object is undeleted. A script can be used for performing the checkout operation and for performing further object operations with the checked out object version.

AfterUndeleteObjectFinalize

This event is triggered after the object undelete operation is complete and you are able to work with the undeleted object.

BeforeModifyMFilesCredentials

AfterModifyMFilesCredentials

BeforeModifyMFilesCredentials: The event handler is triggered before the password of the M-Files login account is changed.

AfterModifyMFilesCredentials: The event handler is triggered after the password of the M-Files login account is changed.

BeforeCheckinChangesFinalize

The BeforeCheckinChangesFinalize event handler is triggered before an object is checked in, but after the state transitions and signatures have been finalized. Workflow changes are not allowed.

BeforeAddUserGroupMember

AfterAddUserGroupMember

BeforeAddUserGroupMember: The event is triggered before a member is added to a user group in the vault database. AfterAddUserGroupMember: The event is triggered after a member is added to a user group in the vault database.

BeforeRemoveUserGroupMember

AfterRemoveUserGroupMember

BeforeRemoveUserGroupMember: The event is triggered before a member is removed from a user group in the vault database. AfterRemoveUserGroupMember: The event is triggered after a member is removed from a user group in the vault database.

Server-level event handlers

This section lists event handlers that are triggered by server-level operations. These operations also cause a corresponding event to be executed in all online vaults of the server.

Note: An exception in a server-level event handler prevents the triggering operation from being executed, but any vault-level event handler exceptions do not affect server-level operations.
Event handler Variables Execution

BeforeRunScheduledJob

AfterRunScheduledJob

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.

BeforeCreateLoginAccount

AfterCreateLoginAccount

BeforeCreateLoginAccount: The event is triggered for all online vaults before a login account is created on the server.

AfterCreateLoginAccount: The event is triggered for all online vaults after a login account is created on the server.

BeforeModifyLoginAccount

AfterModifyLoginAccount

BeforeModifyLoginAccount: The event is triggered for all online vaults before a login account is modified on the server.

AfterModifyLoginAccount: The event is triggered for all online vaults after a login account is modified on the server.

BeforeRemoveLoginAccount

AfterRemoveLoginAccount

BeforeRemoveLoginAccount: The event is triggered for all online vaults before a login account is removed from the server.

AfterRemoveLoginAccount: The event is triggered for all online vaults after a login account is removed from the server.

BeforeModifyMFilesCredentials

AfterModifyMFilesCredentials

BeforeModifyMFilesCredentials: The event handler is triggered for all online vaults before the password of an M-Files login account is changed.

AfterModifyMFilesCredentials: The event handler is triggered for all online vaults after the password of an M-Files login account is changed.