Automated update of records from M-Files

Updating a class table is not automatically called on a change of a record in M-Files. There are various methods that can be used to action or schedule an update.

If SQL Server Standard (or higher) edition is used for MFSQL Connector, use a SQL Agent job. Refer to Using Agent for automated updates for more details.

If SQL Express edition is used, then use the PowerShell utility to schedule a task.

In either case the procedure spMFUpdateAllncludedInAppTables will allow for both incremental and full updates.

We recommend scheduling an incremental update at an appropriate interval for your needs, as well as a full update at least once a day.

Note

Records deleted in M-Files is not picked up by the incremental update. It requires a full update to be picked up.

Updates on demand

Updates triggered by an M-Files event

Before making changes in SQL

The general rule is to always update from M-Files before a record is changed in SQL. This is done by first calling the spMFUpdateTable with method 1 for the records that will be updated and then to call spMFUpdateTable with update method 0 after the the SQL record is update to push the update back to M-Files. The procedure spMFUpdateMFilesToMFSQL is particularly valuable in this regard. Depending on the requirement and volume of data to be taken into account other update procedures can also be used as outline in section Insert Update of Class Records.

Using an agent

If the requirement is to refresh the class tables at intervals (for instance overnight, or every 2 hours) an agent can be used with

On demand in an external application

An action button in an external application can call spMFUpdateTable with update method 1; alternatively spMFUpdateTableWithLastModifiedDate can be used.

Action from within M-Files using Context Menu

The Using the Context Menu plug-in allows to call any one of the updating procedures by activating the update from within M-Files. The two options include triggering the procedure without any object level parameters and one that allows for the selected object parameters to be passed through to the procedure.

Note

The rows in MFContextMenu controls the operations of the action menu in M-Files. Check this table if the action item does not work. In particular, ensure that column IsProcessRunning is not stuck on 1.

Action as part of a workflow script

We are currently working on a method that will allow for calling the procedure by using the context menu vault application from a workflow. This will trigger the update from the workflow state change.