3. User messages and notifications

3.1. Scenarios

  • Sending targeted user messages during integration runs

  • Bulk emails and opt‑out handling

  • Integrating with external notification platforms

3.2. User messages in M‑Files

  • System failures are logged to MFLog and can be emailed to a support address configured in MFSettings.

  • Core processes can post user‑visible messages via MFProcessBatch with LogType = ‘Message’, which a trigger surfaces in MFUserMessages using spMFResultMessageForUI.

  • Add MFSQL Message and MFSQL Process Batch properties on relevant classes to surface messages per object; populate these in your custom procedures.

3.3. Bulk email notifications

Version 4.9.26.67 introduced templated bulk email via Database Mail. - Define templates in MFEmailTemplate. - Convert result sets to HTML via spMFConvertTableToHtml. - Send HTML emails via spMFSendHTMLBodyEmail. - Track outcomes in MFEmailLog.

3.4. Best practices

  • Enable Database Mail and set EmailProfile/SupportEmailAccount in MFSettings.

  • Use a TestOnly parameter during development to avoid mass mail.

  • Drive table content for emails with parameterized SELECT that writes into a temporary table (##report) from ObjID.

3.5. Detailed guide

3.5.1. Access error messages in MFLog

System failure messages are logged in the MFLog table and can be automatically sent by email to the support email address specified in MFSettings (requires Database Mail).

SELECT TOP 10 * FROM MFLog ORDER BY LogID DESC;
Example of a user message banner in M-Files

User message banner example in the M-Files UI. :alt: Access error message in MFLog

3.5.2. Get error messages to email

  1. Install and configure Database Mail on the server (default profile ‘MailProfile’ unless changed).

  2. Update MFSettings with the mail profile and recipient addresses (semicolon‑separated).

EXEC spMFSettingsForDBUpdate @SupportEmailAccount = 'support@lamininsolutions.com',
                                                                          @EmailProfile = 'MailProfile';
Example of a user message with details

User message with additional details visible to the user. :alt: Example email configuration

3.5.3. Add process messages to individual objects

To show per‑object messages on the metadata card, add two properties: MFSQL Message and MFSQL Process Batch, and ensure columns exist in the class table:

ALTER TABLE dbo.MFCustomer
  ADD mfsql_Message NVARCHAR(4000), mfsql_Process_batch INT;

Populate these fields in your custom procedures; include the ProcessBatch ID to link back to logs.

Context message dialog example

Context message dialog with action options. :alt: Message on metadata card

3.5.4. Get standard process messages in M‑Files

Core processes can generate entries in MFUserMessages, surfaced via a view in M-Files. Enable via MFSettings:

EXEC dbo.spMFSettingsForDBUpdate @UserMessageEnabled = '1';
Result notification example

Example of a result notification for an operation. :alt: Example of process message in M‑Files

3.5.5. Add custom message in MFUserMessages

User‑facing messages can be triggered by inserting MFProcessBatch rows with LogType = ‘Message’; a trigger will insert into MFUserMessages using spMFResultMessageForUI.

SET @Msg = 'Session: ' + CAST(@SessionIDOut AS VARCHAR(5));
IF @UpdateRequired > 0 SET @Msg += ' | Update Required: ' + CAST(@UpdateRequired AS VARCHAR(5));
IF @LaterInMF > 0        SET @Msg += ' | MF Updates : '      + CAST(@LaterInMF AS VARCHAR(5));
IF @Process_id_1 > 0     SET @Msg += ' | SQL Updates : '     + CAST(@Process_id_1 AS VARCHAR(5));
IF @Process_id_1 > 0     SET @Msg += ' | SQL New : '         + CAST(@NewSQL AS VARCHAR(5));

SET @LogText = @Msg;
SET @LogStatus = 'Completed'; -- 'Error' or 'Fail' will also trigger a message

EXEC dbo.spMFProcessBatch_Upsert
          @ProcessBatch_ID = @ProcessBatch_ID OUTPUT,
          @ProcessType     = @ProcessType,
          @LogType         = N'Message',
          @LogText         = @LogText,
          @LogStatus       = @LogStatus,
          @Debug           = @Debug;

3.5.6. Show process results in context menu action

Context menu actions can return a completion message for synchronous operations. See Using the Context Menu.

3.5.7. Process custom messages by Email

Use MFProcessBatch and MFProcessBatchDetail for content, then send via Database Mail using a custom procedure.

Web client user message example

User messages shown in the M-Files web client. :alt: Summary email example

Desktop client user message example

User messages shown in the M-Files desktop client. :alt: Detail email example

3.5.8. Bulk email: components and setup

From this guide:

  • Components: - MFEmailLog - MFEmailTemplate - spMFConvertTableToHtml - spMFSendHTMLBodyEmail

  • Configuration steps (abridged): - Prepare class tables and triggers for recipients/events. - Configure the triggering event (e.g., workflow state change); context menu can help stage actions. - Design and insert the email template into tbMFEmailTemplate with placeholders ({head}, {firstname}, {user}, {table}). - Build a custom procedure to orchestrate the send: refresh data, replace placeholders, generate table, loop recipients, send, log, handle errors.

Send bulk email example

Example table layout included in a bulk email. :alt: Example notification with table

3.5.9. Testing and staging

  • Use TestOnly to prevent bulk sends during dev.

  • Review MFEmailLog, clear rows for re‑send scenarios when intentional.

  • Stage notifications via agent batch, object change events, or manual execution—depending on use case.

3.6. See also