Case Status Kiln
Register Log In


FogBugz Plugin Interfaces (All…»Implementing IPluginPersonJoin…
  • RSS Feed

Last modified on 12/15/2014 5:05 PM by User.


Implementing IPluginPersonJoin, IPluginPersonDisplay, IPluginPersonCommit

FogBugz Plugin Interfaces > FogBugs Users > IPluginPersonJoin, IPluginPersonDisplay, IPluginPersonCommit


This article will demonstrate a pair of simple FogBugz plugins that implement the IPluginPersonJoin, IPluginPersonDisplay, and IPluginPersonCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.


IPluginPersonDisplay and IPluginPersonCommit

In this example, two plugins are created that each add a custom field to a FogBugz "User Options" page. One adds a control allowing you assign a "Level of Awesomeness" to a user, and the other adds text box input allowing you to give the user a "Secret Code Name." In addition, each plugin generates a checkbox control allowing the user to force the IPluginPersonCommit function ProjectCommitBefore to return false, thereby causing the commit to fail. To demonstrate how commit and rollback occurs (and the order in which they occur across two plugins that each implement IPluginProjectCommit), all of the member functions of IPluginPersonCommit generate a UI notification (using CPluginApi.Notifications) indicating that they were called.

If you upload the plugin and play around with it, you'll notice that:

  • For the PersonCommitBefore and PersonCommitAfter methods, FogBugz handles each plugin instance implementing IPluginPersonCommit 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 PersonCommitRollback method, FogBugz first handles the plugin instance that returned false from PersonCommitBefore, then calls the PersonCommitRollback function of all plugin instances that previously called PersonCommitBefore in reverse order (ie, they're "popped off the stack.").


Each of the example plugins use the IPluginPersonJoin method to specify a table containing an integer "ixPerson" column, allowing FogBugz to automatically join the columns of that table to the "Person" table. This allows the plugin developer to use CPerson.GetPluginField() and CPerson.GetPluginFieldOriginal() to easily retrieve column values from the joined table,  and use CPerson.SetPluginField() to specify a value to be set upon commit.

Compile and Install It On Your Own

Download the source files:   IPluginPersonJoin_Display_Commit_Example_1.cs, IPluginPersonJoin_Display_Commit_Example_2.cs

Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin