Answers.Body: <p>Try creating a Profilewith the necessary Contribution fields and then accessing it via Actions (Bulk update) from the Find Contributions page</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T22:57:29.730Z
Answers.Text: oh maybe you did that but it is not clear from your description
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T22:58:24.273Z
Answers.Text: is the issue that Find Contributions won't let you find empty fields?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T22:59:30.973Z
Answers.Text: 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???
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T23:04:50.370Z
Answers.Text: 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.
Answers.UserDisplayName: themak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-19T03:11:26.933Z
Answers.Text: the sql query should be super easy and then let you do the rest via the UI
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-18T22:56:11.993Z
Answers.LastActivityDate: 2020-02-18T22:56:11.993Z
Answers.UserDisplayName: petednz - fuzion
Answers.Body: <p>You can do either one of the two methods</p>
  
  <ol>
  <li><p>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.</p></li>
  <li><p>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.</p></li>
  </ol>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-19T00:46:16.990Z
Answers.LastActivityDate: 2020-02-19T00:46:16.990Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>You could do this via the API with chaining.  The basic pattern is:</p>
  
  <pre><code>civicrm_api3('Contribution', 'get', [
    'sequential' =&gt; 1,
    'custom_1' =&gt; ['IS NULL' =&gt; 1],
    'api.Contribution.create' =&gt; ['id' =&gt; "\$value.id", 'custom_1' =&gt; "42"],
  ]);
  </code></pre>
  
  <p>Or in words:</p>
  
  <ul>
  <li>Find contributions that you want to update:  this just looks for the
  <code>custom_1</code> field being null.  Add whatever conditions you need. </li>
  <li>When you have a contribution that matches, call Contribution.create with the existing id to update it, and set the field you want. <code>"\$value.id"</code> is a bit of API magic to give you the id of the contribution you just found.</li>
  </ul>
  
  <p>You'll need to add <code>'options' =&gt; ['limit' =&gt; 0]</code> if you want to process all 300 in one go.</p>
  
  <p>You can run this via the API Explorer, or if you have shell access, create a script and run with <a href="https://github.com/civicrm/cv" rel="nofollow noreferrer"><code>cv</code></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-19T10:48:48.390Z
Answers.LastActivityDate: 2020-02-19T10:48:48.390Z
Answers.UserDisplayName: Aidan
Body: <p>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.</p>
  
  <p>Example</p>
  
  <ul>
  <li>Contribution - Custom Field 1 - = - Attribute </li>
  <li>Contribution - Custom Field 2 - Is Empty </li>
  <li>Contribution - Date Received - > - ##/##/####</li>
  <li>Contribution - Amount - > - 1</li>
  </ul>
  
  <p>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.</p>
  
  <p>Is there a better way to do this?</p>
  
  <p>Export/Import is not a good solution.</p>
  
Tags: <civicontribute><contributions><search-builder>
Title: Update Multiple Contributions with Missing Attributes via Search Builder?
ThreadText: # Update Multiple Contributions with Missing Attributes via Search Builder?
  
  (Asked by: username_0 on 2020-02-18)
  
  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.
  
  Example
  
  * 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.
  
  **Tags:** civicontribute, contributions, search-builder
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2020-02-18. Score: 2
  
  Try creating a Profilewith the necessary Contribution fields and then accessing it via Actions (Bulk update) from the Find Contributions page
  
  > **Comments:**
  > **username_1**: oh maybe you did that but it is not clear from your description  
  > **username_1**: is the issue that Find Contributions won't let you find empty fields?  
  > **username_1**: 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???  
  > **username_0**: 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.  
  > **username_1**: the sql query should be super easy and then let you do the rest via the UI  
  
  ---
  
  ### Answer by username_2 on 2020-02-19. Score: 0
  
  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.
  
  HTH
  
  username_2
  
  
  ---
  
  ### Answer by username_3 on 2020-02-19. Score: 0
  
  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`](https://github.com/civicrm/cv)
  
  
  ---
  
  