Creating Menu Items¶
Use Helper Procedures (Recommended)¶
Helper procedures encapsulate required defaults and validation:
spMFContextMenuHeadingItem
spMFContextMenuActionItem
Creating a Heading¶
EXEC dbo.spMFContextMenuHeadingItem
@MenuName = N'Integration Operations',
@PriorMenu = NULL, -- position relative to another heading
@IsRemove = 0, -- set 1 to remove
@IsObjectContextMenu = 0, -- 1 to scope heading to object-context only
@UserGroup = N'ContextMenu';
Creating an Action Item¶
Minimal asynchronous object-context example:
EXEC dbo.spMFContextMenuActionItem
@ActionName = N'Republish Customer',
@ProcedureName = N'custom.RepublishCustomer',
@Description = N'Republish selected customer from SQL to M-Files',
@RelatedMenu = N'Integration Operations',
@IsRemove = 0,
@IsObjectContext = 1,
@IsWeblink = 0,
@IsAsynchronous = 1,
@IsStateAction = 0,
@PriorAction = NULL,
@UserGroup = N'ContextMenu';
URL / Web Link Item¶
EXEC dbo.spMFContextMenuActionItem
@ActionName = N'Support Portal',
@ProcedureName = N'https://support.example.com', -- stored in Action column
@Description = N'Open support knowledge base',
@RelatedMenu = N'Tools',
@IsRemove = 0,
@IsObjectContext = 0,
@IsWeblink = 1,
@IsAsynchronous = 1,
@IsStateAction = 0,
@PriorAction = NULL,
@UserGroup = N'ContextMenu';
Workflow State Target (Action Type 5)¶
Define item referencing state handler procedure:
EXEC dbo.spMFContextMenuActionItem
@ActionName = N'VendorApproved',
@ProcedureName = N'custom.StateAction_VendorApproved',
@Description = NULL,
@RelatedMenu = NULL, -- not shown in menu
@IsRemove = 0,
@IsObjectContext = 0,
@IsWeblink = 0,
@IsAsynchronous = 1,
@IsStateAction = 1,
@PriorAction = NULL,
@UserGroup = N'ContextMenu';
Manual INSERT (Not Preferred)¶
Use only for advanced bulk scripting; mirror columns produced by helpers. Always test in non‑production.
Sorting & Ordering¶
Headings get their own SortOrder sequence; actions scoped within a heading have independent ordering.
Use @PriorMenu / @PriorAction parameters to splice without renumbering entire sets.
Change / Remove Items¶
Set @IsRemove=1 for logical removal via helpers (preserves audit trail rows / potential history patterns).
For permanent purge in dev/test environments you may TRUNCATE then rebuild via scripted seed set.
Validation Checklist¶
Unique ActionName within functional scope.
ProcedureName deployed & signature validated (action-types-and-behavior).
User group present and populated.
ISAsync = 1 unless immediate synchronous feedback required and runtime < 2s.
Next Steps¶
Wire workflow scripts if needed (Workflow and Event Handlers).