We have 300 or so contributions that are missing a custom field. We want to manually update those records. We are running a search for contributions that have a custom field but are missing the custom field we want. We run a search builder.


  • Contribution - Custom Field 1 - = - Attribute
  • Contribution - Custom Field 2 - Is Empty
  • Contribution - Date Received - > - ##/##/####
  • Contribution - Amount - > - 1

I run the search and I find the 300 or so contributions. I can only update each record by clicking on the contact, going to their contributions, finding the contribution, edit the custom fields. If I try to update multiple records - I can only update the contacts - not the contributions. So I add them to a group - run a contribution search for the date range and limit to only the group. Now I have over 700 contributions as those contacts may have given multiple times. I can bulk update the contributions now with a profile - but I now have to sift through half the contributions that do have the correct custom field chosen and find only those that are blank.

Is there a better way to do this?

Export/Import is not a good solution.

3 Answers 3


Try creating a Profilewith the necessary Contribution fields and then accessing it via Actions (Bulk update) from the Find Contributions page

  • oh maybe you did that but it is not clear from your description
    – petednz - fuzion
    Feb 18, 2020 at 22:57
  • is the issue that Find Contributions won't let you find empty fields?
    – petednz - fuzion
    Feb 18, 2020 at 22:58
  • Add another custom field - use SQL to add a value to it whereever your other field is Null/Empty, then use that field in your Find Contributions search???
    – petednz - fuzion
    Feb 18, 2020 at 22:59
  • We did create a custom profile - and we are able to edit the contributions - we just have to sift through a lot of contributions that don't need any updates. The sql option is interesting - we will talk to our developer to see if it is viable. We want to make this as easy as possible for the end user.
    – themak
    Feb 18, 2020 at 23:04
  • the sql query should be super easy and then let you do the rest via the UI
    – petednz - fuzion
    Feb 19, 2020 at 3:11

You can do either one of the two methods

  1. Export all contributions into csv, use csv skills to clear rows that are not empty and then update the rows with necessary data and import it back using contribution ID from import contribution UI.

  2. Use contribution reports(contribution detail report probably) to filter contribution that have empty data for custom fields, export the results with contribution id, update csv file with necessary data and import it back using contribution ID from import contribution UI.




You could do this via the API with chaining. The basic pattern is:

civicrm_api3('Contribution', 'get', [
  'sequential' => 1,
  'custom_1' => ['IS NULL' => 1],
  'api.Contribution.create' => ['id' => "\$value.id", 'custom_1' => "42"],

Or in words:

  • Find contributions that you want to update: this just looks for the custom_1 field being null. Add whatever conditions you need.
  • When you have a contribution that matches, call Contribution.create with the existing id to update it, and set the field you want. "\$value.id" is a bit of API magic to give you the id of the contribution you just found.

You'll need to add 'options' => ['limit' => 0] if you want to process all 300 in one go.

You can run this via the API Explorer, or if you have shell access, create a script and run with cv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.