Answers.Body: <p>The issue is that <code>-&gt;setReload(TRUE)</code> only returns core fields, not custom fields. If you need to fetch a complete record after updating it, I recommend using the api get action for that.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-14T12:35:59.357Z
Answers.LastActivityDate: 2024-06-14T12:35:59.357Z
Answers.UserDisplayName: Coleman
Body: <p>Have been trying to love the new API4 and it is not easy to.</p>
  <pre><code>$results = \Civi\Api4\Participant::update(FALSE)
    -&gt;addValue('CustomFieldGroup.Custom_Field', 4809119164241588000)
    -&gt;setReload(TRUE)
    -&gt;addWhere('id', '=', 5678) //Participant ID
    -&gt;execute();
  foreach ($results as $result) {
    // do something
  }
  </code></pre>
  <p>Would love to &quot;do something&quot; but the field value doesn't get updated it seems.
  What am I missing?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-13T19:32:33.920Z
Comments.Text: What api action is this? Update?
  I suspect it is getting updated, but not returned by "reload" because that probably doesn't include custom fields.
  Did you try doing a "get" afterwards to check if the update was successful?
  NB: It's not common to "do something" with the results of an update, typically you just update the record and that's it.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-06-14T09:34:41.143Z
Comments.Text: @Coleman Thank you! Indeed, it is the "Result" reload issue, the field gets updated fine.
Comments.UserDisplayName: yurg
Tags: <participants><api4>
Title: API4 - update Participant custom field value?
ThreadText: # API4 - update Participant custom field value?
  
  (Asked by: username_0 on 2024-06-13)
  
  Have been trying to love the new API4 and it is not easy to.
  
  ```
  $results = \Civi\Api4\Participant::update(FALSE)
    ->addValue('CustomFieldGroup.Custom_Field', 4809119164241588000)
    ->setReload(TRUE)
    ->addWhere('id', '=', 5678) //Participant ID
    ->execute();
  foreach ($results as $result) {
    // do something
  }
  
  ```
  
  Would love to "do something" but the field value doesn't get updated it seems.
  What am I missing?
  
  **Tags:** participants, api4
  
  > **Comments:**
  > **username_1**: What api action is this? Update? I suspect it is getting updated, but not returned by "reload" because that probably doesn't include custom fields. Did you try doing a "get" afterwards to check if the update was successful? NB: It's not common to "do something" with the results of an update, typically you just update the record and that's it.  
  > **username_0**: @username_1 Thank you! Indeed, it is the "Result" reload issue, the field gets updated fine.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-06-14. Score: 1 | Accepted answer
  
  The issue is that `->setReload(TRUE)` only returns core fields, not custom fields. If you need to fetch a complete record after updating it, I recommend using the api get action for that.
  
  
  ---
  
  