With the advent of FogBugz 7 and the new plugin system, new possibilities arise for us FogBugz users. Here is a tip on how to extend cases in this brilliant system with a custom field and add some functionality to it. Similar to the Related Cases feature, my scenario was that I wanted to connect cases to a wiki page with related information. My recipe is as follows:
Prerequisites
We need the Custom Field plugin by FogCreek and BugMonkey by Michael Pryor. If you’re a FogBugz on Demand user these are readily available in the Plugins admin panel.
Adding a custom field
Next, configure the Custom Field plugin and add a number field named “Wiki Page” with the description “Related wiki page”. Make a note of the description since it will come in handy later.
You will now have an extra field on each case called Wiki Page in which we expect users to enter the page id of a related wiki.
Making the field a link to the wiki page
Now go and configure the BugMonkey plugin. This plugin enables javascript to be executed on every page in your FogBugz installation. Luckily, the FogCreek team have already added JQuery into FogBugz mix so we can ride on that. Add the following script in the javascript text area:
var wikiPage = $(“.content[title=’Related wiki page’]”);
wikiPage.html(“<a href=”/?W + wikiPage.text() + “>Related wiki page</a>”);
The content of the wiki page field is rendered as a div element with class “content” and a title containing the field description. Thus, using JQuery to look up the element is a breeze.
After grabbing the element it is straightforward to add an anchor pointing to the wiki page url.
Conclusion
Ideally I would love to see the Custom Field plugin add the field name to the html element, perhaps as and id. Apart from that, with a plugin system and an eager developer community, systems like FogBugz can really reach new levels of extendability without having to put all possible features into the product up front.
Thumbs up for a great product, Fog Creek!