As of FogBugz 8.0, you can now get and set plugin values (Custom Fields plugin or another such as Project Backlog or Kanban) on cases if you know their super-secret (long) name. You can get values if you only know part of the name, which will also then tell you the long name.
I have a custom field called “adada” and the Project Backlog plugin. I issue an API request:
I get back some XML:
<?xml version="1.0" encoding="UTF-8"?><response> <casescount="1"> <caseixBug="144"operations="edit,spam,assign,resolve,reply,forward"> <sTitle><![CDATA[Godkänna CleanCash]]></sTitle> <sCategory><![CDATA[Inquiry]]></sCategory> <adada>123123</adada> <plugin_customfields_at_fogcreek_com_adadai67> 123123 </plugin_customfields_at_fogcreek_com_adadai67> <backlog>1</backlog> <plugin_projectbacklog_at_fogcreek_com_ibacklog> 1 </plugin_projectbacklog_at_fogcreek_com_ibacklog> </case> </cases></response>
It includes the name of the key I specified and its long name. Note that there may be duplicates of the short name, so it’s better to use the long name. Setting a a value requires using the long name (it’s too dangerous to guess):
- If you want to get all the custom fields you have setup, use
- When querying a custom field via the XML API, you’ll need to substitute an ‘x’ for each space or special character (such as ‘?’) in the custom field name. For example, “My Field 1” should be “MyxFieldx1” when used with
- The name of the custom field used with
colsalways matches the first name of the custom field. If you change the name of the custom field, although all areas of FogBugz will display the new name, the XML API will still expect the original name when used with
Known Issues as of FogBugz 8.8.49:
Note that you cannot set or Date or Date and Time type field via the XML API. Searching on Date or Date and Time custom fields via the XML API is not currently supported.
This is not possible in FogBugz 7.
New Case Creation
To set the custom field value for a new case via the XML API you should be able to use the following method. Note that this is not an official API feature, so it may not work under all circumstances.
- Create your new custom field
- Bring up the new case page and use Firebug or the Chrome Inspector to inspect the input for your new custom field to get the “name” attribute. It should look like “P7_severityI61”. In this case “severity” will be the name of your field and the numbers may be different.
- Pass this argument along to the XML API for your request.
Editing a Case
To edit the custom field value for an existing case, the above method does not work.