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

Document vault event handlers

Server event handlers

Document vault event handlers

BeforeSetProperties and AfterSetProperties
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, PropertyValues, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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 and AfterCreateNewObjectFinalize
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, PropertyValues, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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 and AfterCancelCreateObject
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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, for instance, when the user performs the "Undo Checkout" function on the object or removes the object from the document vault.
BeforeCheckInChanges and AfterCheckInChanges
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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. 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 and AfterCancelCheckOut
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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 and AfterCheckOut
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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.
BeforeDeleteObject and AfterDeleteObject
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handlers are executed when an object is marked as deleted.
BeforeDestroyObject and AfterDestroyObject
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handlers are executed when an object is destroyed from the document vault.
BeforeDestroyObjectVersion and AfterDestroyObjectVersion
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handlers are executed when an individual version of the object is destroyed from the document vault.
BeforeSetObjectPermissions and AfterSetObjectPermissions
Variables ObjectAccessControlList, ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handlers are executed when the object permissions are changed.
BeforeFileUpload
Variables FileTransferSessionID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handler is executed when the user starts a file transfer to M-Files Server.
AfterFileUpload
Variables FileTransferSessionID, FileVer, ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handler is executed when the file transfer to the server is completed.
BeforeFileDownload and AfterFileDownload
Variables FileTransferSessionID, ObjID, FileVer, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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 and AfterCreateNewValueListItem
Variables ValueListItem, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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, for example, ensure that all values entered in the value list are in a specified form as desired.
BeforeLoginToVault
Variables LoginAccount, Vault, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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 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
Variables LoginAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handler is executed when the user has successfully logged in to the document vault.
BeforeLogoutFromVault
Variables Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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 LoggedOutUserID, Vault, VaultSharedVariables, SavepointVariables, TransactionCache, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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 RestoredVersions, Vault, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, ObjVer, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
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 RestoredVersions, Vault, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, ObjVer, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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
Variables Input, Output, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The event handler is invoked explicitly by the client (the so-called vault extension method).
BeforeCreateLoginAccount and AfterCreateLoginAccount
Variables LoginAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeCreateLoginAccount: an event that is triggered for all online vaults before a login account is created on the server. An exception in the event does not prevent the operation to be executed. AfterCreateLoginAccount: an event that is triggered for all online vaults after a login account is created on the server.
BeforeModifyLoginAccount and AfterModifyLoginAccount
Variables LoginAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeModifyLoginAccount: an event that is triggered for all online vaults before a login account is modified on the server. An exception in the event does not prevent the operation to be executed. AfterModifyLoginAccount: an event that is triggered for all online vaults after a login account is modified on the server.
BeforeRemoveLoginAccount and AfterRemoveLoginAccount
Variables LoginAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeRemoveLoginAccount: an event that is triggered for all online vaults before a login account is removed from the server. An exception in the event does not prevent the operation to be executed. AfterRemoveLoginAccount: an event that is triggered for all online vaults after a login account is removed from the server.
BeforeCreateUserAccount and AfterCreateUserAccount
Variables UserAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeCreateUserAccount event is triggered for all online vaults before a user account is created on the server. The AfterCreateUserAccount event is, in turn, executed for all online vaults after a user account is created.
BeforeModifyUserAccount and AfterModifyUserAccount
Variables UserAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeModifyUserAccount event is triggered for all online vaults before a user account is modified on the server. The AfterModifyUserAccount event is, in turn, executed for all online vaults after the modification.
BeforeRemoveUserAccount and AfterRemoveUserAccount
Variables UserAccount, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeRemoveUserAccount event is triggered for all online vaults before a user account is removed from the server. The AfterRemoveUserAccount event is, in turn, executed for all online vaults after the removal.
BeforeCreateUserGroup and AfterCreateUserGroup
Variables UserGroupAdmin, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeCreateUserGroup event is triggered for all online vaults before a user group is created on the server. The AfterCreateUserGroup event is, in turn, executed for all online vaults after the user group is created.
BeforeModifyUserGroup and AfterModifyUserGroup
Variables UserGroupAdmin, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeModifyUserGroup event is triggered for all online vaults before a user group is modified on the server. The AfterModifyUserGroup event is, in turn, executed for all online vaults after the modification.
BeforeRemoveUserGroup and AfterRemoveUserGroup
Variables UserGroupAdmin, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeRemoveUserGroup event is triggered for all online vaults before a user group is removed from the server. The AfterModifyUserGroup event is, in turn, executed for all online vaults after the removal.
AfterBringOnline and BeforeTakeOffline
Variables Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The AfterBringOnline event is triggered after the vault is brought online. The BeforeTakeOffline event, in turn, 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
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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.
BeforeReturnView
Variables CurrentUserID,CurrentUserSessionInfo, View, Vault, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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 and AfterUndeleteObject
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution The BeforeUndeleteObject event handler is triggered before an object is undeleted. The AfterUndeleteObject 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
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution This event is triggered after the object undelete operation is complete and you are able to work with the undeleted object.
BeforeModifyMFilesCredentials and AfterModifyMFilesCredentials
Variables Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MasterTransactionID, CurrentTransactionID, ParentTransactionID, ActivityID, GetExtensionObject
Execution The BeforeModifyMFilesCredentials event handler is triggered before the password of the M-Files login account is changed, and the AfterModifyMFilesCredentials event handler after the password of the M-Files login account is changed.

Server event handlers

BeforeRunScheduledJob and AfterRunScheduledJob
Variables MFScriptCancel, CurrentUserID, ScheduledJob, ScheduledJobOutputInfo, CurrentUserSessionInfo, GetExtensionObject, GetExtensionObject
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.
BeforeCreateLoginAccount and AfterCreateLoginAccount
Variables LoginAccount, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeCreateLoginAccount: an event that is triggered before a login account is created on the server. AfterCreateLoginAccount: an event that is triggered after a login account is created on the server.
BeforeModifyLoginAccount and AfterModifyLoginAccount
Variables LoginAccount, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeModifyLoginAccount: an event that is triggered before a login account is modified on the server. AfterModifyLoginAccount: an event that is triggered after a login account is modified on the server.
BeforeRemoveLoginAccount and AfterRemoveLoginAccount
Variables LoginAccount, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution BeforeRemoveLoginAccount: an event that is triggered before a login account is removed from the server. AfterRemoveLoginAccount: an event that is triggered after a login account is removed from the server.
BeforeModifyMFilesCredentials and AfterModifyMFilesCredentials
Variables CurrentUserID, CurrentUserSessionInfo, GetExtensionObject
Execution The BeforeModifyMFilesCredentials event handler is triggered before the password of the M-Files login account is changed, and the AfterModifyMFilesCredentials event handler after the password of the M-Files login account is changed.
BeforeCheckinChangesFinalize
Variables ObjVer, DisplayID, Vault, CurrentUserID, CurrentUserSessionInfo, VaultSharedVariables, SavepointVariables, TransactionCache, MFScriptCancel, GetExtensionObject, MasterTransactionID, CurrentTransactionID, ParentTransactionID
Execution 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.