Case Status Kiln
Register Log In


Interact with other plugins us…»Get and Set Another Plugin's B…
  • RSS Feed

Last modified on 1/2/2015 2:29 PM by User.


Get and Set Another Plugin's Bug-Joined fields

the CBug GetPluginField() and SetPluginField() methods allow you not only to work with your own plugin's fields but any other plugin's. For example, you can access case fields the user has added with Custom Fields. If you know the field name, you can do this:

CBug bug = api.Bug.GetBug(123);
// use the "sColumnName" of the field from the Plugin_X_CustomField table in the database
string sCaseColor = bug.GetPluginField("", "color71");
bug.SetPluginField("", "Color71", "green");

Or you can get all the fields added by all plugins with GetAllPluginFields():

string s = "";
CBug bug = api.Bug.GetBug(123);
CStrStrObjTuple[] rgFields = bug.GetAllPluginFields();
foreach (CStrStrObjTuple field in rgFields)
    s += HttpUtility.HtmlEncode(field.sFirst) + ", " +
    HttpUtility.HtmlEncode(field.sSecond) + ", " +
    HttpUtility.HtmlEncode(field.oThird == null ? "NULL" : field.oThird.ToString()) + "\r\n";

Which gives you something like this for s:, color71, green, fKilnReview, 0, iBacklog, NULL