How Do I Copy Data from One Custom Field To Another on Multiple Cases?


Follow

Overview 

You have a need to copy the data from one custom field to another custom field on a large number of cased and would like to know if it is possible to do that in a bulk edit.

Solution

There are two ways to update data in a case that includes custom fields in bulk:

  • The Bulk Edit functionality in the FogBugz UI
  • Using the FogBugz API to Programmatically 

Using the Bulk Edit Functionality

As described in the article Using Bulk Edit to Edit Several Cases at Once, you can edit the fields of multiple cases at the same time, including custom fields.   

If you are modifying any closed cases, the closed cases will need to be re-opened to apply the data change.

Using the FogBugz API

The custom fields can be edited programmatically Using the FogBugz API.  Using the FogBugz API to modify cases does not require you to re-open any closed cases before editing. 

If you are not familiar with the FogBugz API please review our comprehensive API Knowledge Base.   The article View and Update Custom Fields with the XML API provides information on how to retrieve and update custom fields with the FogBugz API.

An example of using the FogBugz API to retrieve and update custom fields using python please review the attached script bulkCopyPasteCustomField.py.  The following values in the script will need to be modified in this script to work with your FogBugz instance:

  • line 5: bugs are the cases you want to edit: [9,10,11]. You can add as many cases as you like here comma separated.
  • line 8: substitute <your-API-token> for your API token
  • line 11: substitute <your-subdomain> for your domain. It's the part before the ".fogbugz.com" in your URL (less the https:// part).
  • line 14: substitute <Field-to-be-copied> with the custom field's internal name where the value you want to copy is located.
  • line 17: substitute <field-to-copy-to> with the custom field's internal name where you want the value above copied to.