Send Notification to M-Files User
In this example we will use the SendUserNotification method to send a simple notification message on a workflow state change. To do this we will add code to the workflow State Actions
Example
- Open M-Files Admin, then expand 'Connections to M-Files Servers\Local Computer\Document Vaults'
- Expand the desired vault and select 'Workflows' node
- Configure a simple workflow as shown below
- Double-click the state on which you want to send the Notification (e.g. Listed for approval)
- In the 'State Properties' dialog, select the 'Actions' tab
- Check the 'Run Script' option, then click the 'Edit Code..' button
- In the 'Edit VBScript code' window, add the following code
Sample VBScript
'create PentagonDOCS Notification object
Set ExDOCSNotification = GetExtensionObject("PentagonDOCS.Notifications")
'write details to the log
ExDOCSNotification.WriteLog ActivityID, "SendUserNotification - Example"
'call SendUserNotification
ExDOCSNotification.SendUserNotification CurrentUserID.Value, objVer, "default", CurrentUserID.Value, ActivityID