FogBugz Plugin Interfaces > FogBugz Cases > IPluginBugCommit, IPluginBugDisplay, and IPluginBugJoin
Introduction
This article will demonstrate a simple FogBugz plugin that implement the IPluginBugJoin, IPluginBugDisplay, and IPluginBugCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.
Note
If you wish to add a custom field to FogBugz cases complete with the associated filter option, grid column and search axis, you can do this much more easily using the BugField library. BugField is a convenient wrapper to the individual interfaces which does most of the work for you. See Using the BugField Library for full details and an example plugin.
Functionality
IPluginBugDisplay and IPluginBugCommit
In this example, a plugin is created that adds a custom field to the case view and edit pages allowing you assign a "Secret Code Name" to the case. This field is shown on the left side of the case in view and edit mode. It is only shown in view mode if it has a value, and includes an icon for display in the "Add Fields" area in edit mode just like a built-in field. The field is not shown in edit or view mode for public submissions. Upon committing a case, the plugin checks whether the field has changed and only updates it and adds a changeline to the bugevent if it has.
IPluginBugJoin
This plugin uses the IPluginBugJoin interface to specify a table containing an integer "ixBug" column, allowing FogBugz to automatically join the columns of that table to the "Bug" table. This allows the plugin developer to use CBug.GetPluginField() and CBug.GetPluginFieldOrig() to easily retrieve column values from the joined table, and use CBug.SetPluginField() to specify a value to be set upon commit.
The new field, "Secret Code Name" is added to the additional fields list with the icon we provide via the IPluginStaticFile interface.
In edit mode, the custom field behaves just like any other field:
View mode after the case has been submitted:
Compile and Install It On Your Own
Download the source file: IPluginBugJoin_Display_Commit_Example.cs
Put this image in a folder named "static" and zip it alongside your dll when installing shh_icon.gif
Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin