Initialize the application
This guide walks through initializing MFSQL Connector for a new or refreshed setup, including connection test, metadata update, table creation, updates, and common utilities.
Connection Test
Test the connection to M-Files.
EXEC spMFVaultConnectionTest;
Metadata Synchronization
Synchronize metadata for the first time or update.
EXEC dbo.spMFDropAndUpdateMetadata @IsResetAll = 0;
Class Table Management
View and update class tables, then create all tables needed for your app.
SELECT * FROM MFClass;
UPDATE MFClass
SET IncludeInApp = 1
WHERE Name IN ('Loan', 'Member Account', 'Tenant', 'Account Document', 'Employee', 'Document Type', 'Scion Template', 'Address');
SELECT TableName FROM MFClass WHERE IncludeInApp = 1;
EXEC spMFCreateAllMFTables;
Class Table Updates
Update all included class tables and check table stats.
EXEC spMFUpdateAllncludedInAppTables @UpdateMethod = 1, @IsIncremental = 0;
EXEC spMFClassTableStats;
Error Checking
Show recent errors from the log.
SELECT TOP 3 * FROM mflog ORDER BY logid DESC;
Structure and Metadata Views
View metadata structure for a specific class.
SELECT class, * FROM dbo.MFvwMetadataStructure WHERE class = 'Tenant';
Lookup and Workflow Views
Create lookup and workflow state views.
EXEC dbo.spMFCreateValueListLookupView @ValueListName = 'Country',
@ViewName = 'MFvwCountry',
@Debug = 0;
EXEC dbo.spMFCreateWorkflowStateLookupView @WorkflowName = 'Approval Flow',
@ViewName = 'MFvwApproval_State',
@Debug = 0;
Alias Management
Create or remove aliases for tables.
DECLARE @ProcessBatch_ID INT;
EXEC dbo.spMFAliasesUpsert @MFTableNames = 'MFClass',
@Prefix = 'c',
@IsRemove = 0,
@WithUpdate = 1,
@ProcessBatch_ID = @ProcessBatch_ID OUTPUT,
@Debug = 0;
EXEC dbo.spMFAliasesUpsert @MFTableNames = 'MFClass',
@Prefix = 'c',
@IsRemove = 1,
@WithUpdate = 1,
@ProcessBatch_ID = @ProcessBatch_ID OUTPUT,
@Debug = 0;
Customise Settings
Update support email account.
EXEC dbo.spMFSettingsForDBUpdate @SupportEmailAccount = 'support@yourdomain.com';