Case Status Kiln
Register Log In


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

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


Implementing IPluginTimeIntervalJoin and IPluginTimeIntervalCommit

FogBugz Plugin Interfaces > EBS / Work Tracking > IPluginTimeIntervalJoin and  IPluginTimeIntervalCommit


This article will demonstrate simple code for a FogBugz plugin that implements the IPluginTimeIntervalJoin and IPluginTimeIntervalCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.


The plugin code presented allows you assign a "Level of Awesomeness" to a time interval record used in the Evidence-Based Scheduling (EBS) algorithm, and provides a template for performing custom operations when a time interval record is comitted to the FogBugz database. This occurs whenever a case with time logged against it is assigned any of the resolved statuses "Completed", "Fixed", "Implemented", or "Responded" or when an entry is made in the timesheet via the Working On menu.


To demonstrate how time interval commit and rollback occurs, all of the member functions of IPluginTimeIntervalCommit generate a UI notification (using CPluginApi.Notifications) indicating that they were called.

In the event that multiple installed plugins implement the IPluginTimeIntervalCommit interface:

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


The example plugin uses the IPluginTimeIntervalJoin method to specify a table containing an integer "ixInterval" column, allowing FogBugz to automatically join the columns of that table to the "TimeInterval" table. This allows the plugin developer to use CTimeInterval.GetPluginField() and CTimeInterval.GetPluginFieldOriginal() to easily retrieve column values from the joined table,  and use CTimeInterval.SetPluginField() to specify a value to be set upon commit.


The current version of the plugin API does not provide an interface to allow modification of the timesheet editor (accessed via the Working On menu). Look for this in a future version.

Compile and Install It On Your Own

Download the source file:   IPluginTimeIntervalJoin_Commit_Example.cs

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