FogBugz Plugin Interfaces > EBS / Work Tracking > IPluginFixForJoin, IPluginFixForCommit
Introduction
This article will demonstrate simple code for a FogBugz plugin that implements the IPluginFixForJoin and IPluginFixForCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.
Functionality
The plugin code presented allows you assign a "Level of Awesomeness" to a project milestone, and provides a template for performing custom operations when a project milestone is comitted to the FogBugz database. This occurs whenever an milestone is created or edited on the "Edit Project" page or from the FogBugz case list.
IPluginFixForCommit
To demonstrate how bug commit and rollback occurs, all of the member functions of IPluginFixForCommit generate a UI notification (using CPluginApi.Notifications) indicating that they were called.
In the event that multiple installed plugins implement the IPluginFixForCommit interface:
- For the FixForCommitBefore and FixForCommitAfter methods, FogBugz handles each plugin instance implementing IPluginFixForCommit in the order that the plugin was installed. (The CPluginApi.PluginPrefix property reveals this; for example it will return "P4" if called from the 4th plugin ever installed on the FogBugz site.)
- For the FixForCommitRollback method, FogBugz first handles the plugin instance that returned false from FixForCommitBefore, then calls the FixForCommitRollback function of all plugin instances that previously called FixForCommitBefore in reverse order (ie, they're "popped off the stack").
IPluginFixForJoin
The example plugin uses the IPluginFixForJoin method to specify a table containing an integer "ixFixFor" column, allowing FogBugz to automatically join the columns of that table to the "FixFor" table. This allows the plugin developer to use CFixFor.GetPluginField() and CFixFor.GetPluginFieldOriginal() to easily retrieve column values from the joined table, and use CFixFor.SetPluginField() to specify a value to be set upon commit.
Compile and Install It On Your Own
Download the source file: IPluginFixForJoin_Commit_Example.cs
Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin