In this example we will use the SendGroupNotification method to send a notification message to a group of users 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 
  • Select User Groups and note down the ID of the Group you wish to send Notification to in this example it is EmailGroup, ID 101
  • Now 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, '101' is the group ID


Sample VBScript

'create PentagonDOCS Notification object

Set ExDOCSNotification = GetExtensionObject("PentagonDOCS.Notifications")


'write details to the log

ExDOCSNotification.WriteLog ActivityID, "Send Group Notification"


'send the notification

ExDOCSNotification.SendGroupNotification CurrentUserId.Value, objVer, "default",101, ActivityID