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 standard edition is used for MFSQL Connector, then use and SQL Agent job. refer to Using Agent for automated updates for more details
If SQL express edition then use the powershell special add in to schedule a task.
In either case the procedure spMFUpdateAllncludedInAppTables will allow for both incremental and full updates.
We recommend to schedule an incremental update with 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 change 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 to 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 external application¶
An action button in the external button (e.g. Code on Time action) can call spmfUpdateTable with update method 1; alternatively spMFUpdateTablewithLastModifiedDate can be used.
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.