Answers.Body: <p>Not a direct answer to your question, but you might contemplate using <a href="https://civicrm.org/extensions/civirules" rel="nofollow noreferrer">CiviRules</a> to update the case custom field?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-13T10:01:19.323Z
Answers.Text: Thank you @ErikH well for now and because i'm in rush what i used to update was sql query to update the custom field table entries. And it's working but i will have a look on that too.
Answers.UserDisplayName: Ali Karchoud
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-12T12:14:08.380Z
Answers.LastActivityDate: 2017-07-12T12:14:08.380Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>This looks like a bug to me. Looking at the code you can see in <a href="https://github.com/civicrm/civicrm-core/blob/master/api/v3/Case.php#L62-L62" rel="nofollow noreferrer"><code>civicrm_api3_case_create</code></a> that if the ID is already set it calls <code>civicrm_api3_case_update</code>. </p>
  
  <p><code>civicrm_api3_case_update</code> has no call to the <code>CRM_Case_BAO_Case::create</code> method, which is the only mention I see of custom parameter creation in the BAO.</p>
  
  <p>In fact api/v3/Case.php contains only one mention of the word "custom". It's surprising that something like this could have been left out and maybe I'm missing something, but when I tried creating a custom field for a Case locally and setting some custom values nothing was created.</p>
  
  <p>I'd suggest mentioning this in <a href="https://chat.civicrm.org/civicrm/channels/user-support" rel="nofollow noreferrer">Mattermost</a> or just going ahead and creating a bug report for it on <a href="https://issues.civicrm.org/jira/" rel="nofollow noreferrer">Jira</a></p>
  
  <p>Edit:</p>
  
  <p><a href="https://issues.civicrm.org/jira/browse/CRM-18082" rel="nofollow noreferrer">This issue</a> is about custom data being ignored by the case API but is still open.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-06T04:04:33.713Z
Answers.Text: I am having the same issue.  I ended up just doing a query directly in the DB through the Drupal abstraction layer.  Not the best things but it works.
Answers.UserDisplayName: Josh
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-12T08:59:45.607Z
Answers.LastActivityDate: 2017-07-12T10:25:36.893Z
Answers.LastEditDate: 2017-07-12T10:25:36.893Z
Answers.UserDisplayName: mickadoo
Answers.Body: <p>Unfortunately the Case API doesn't support custom fields... However, good news! From 4.7.25 the Case API DOES supports custom fields!
  <a href="https://issues.civicrm.org/jira/browse/CRM-18082" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-18082</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-16T21:09:06.163Z
Answers.LastActivityDate: 2017-08-16T21:09:06.163Z
Answers.UserDisplayName: Matthew Wire
Body: <p>I have defined a custom field for a particular case type ("adhesion") it's a yes or no field that I need to update when I finish the processing. So I use the Case API to update it passing the id and the new value for the custom field. But this doesn't update the value I get this as a return in the API explorer. I was able to update custom fields in others entities and update case predifined fields using the API.</p>
  
  <p>Is there any explantion for this problem? Any hint on how i can achieve this update action.</p>
  
  <p>Down below is a screenshot from the API explorer <a href="https://i.sstatic.net/d4k7a.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/d4k7a.jpg" alt="enter image description here"></a></p>
  
Tags: <api><civicase>
Title: Updating a custom field set for case entity Civi API
ThreadText: # Updating a custom field set for case entity Civi API
  
  (Asked by: username_0 on 2017-07-11)
  
  I have defined a custom field for a particular case type ("adhesion") it's a yes or no field that I need to update when I finish the processing. So I use the Case API to update it passing the id and the new value for the custom field. But this doesn't update the value I get this as a return in the API explorer. I was able to update custom fields in others entities and update case predifined fields using the API.
  
  Is there any explantion for this problem? Any hint on how i can achieve this update action.
  
  Down below is a screenshot from the API explorer [![enter image description here](https://i.sstatic.net/d4k7a.jpg)](https://i.sstatic.net/d4k7a.jpg)
  
  **Tags:** api, civicase
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2017-07-12. Score: 1
  
  Not a direct answer to your question, but you might contemplate using [CiviRules](https://civicrm.org/extensions/civirules) to update the case custom field?
  
  > **Comments:**
  > **username_0**: Thank you @ErikH well for now and because i'm in rush what i used to update was sql query to update the custom field table entries. And it's working but i will have a look on that too.  
  
  ---
  
  ### Answer by username_2 on 2017-07-12. Score: 1
  
  This looks like a bug to me. Looking at the code you can see in [`civicrm_api3_case_create`](https://github.com/civicrm/civicrm-core/blob/master/api/v3/Case.php#L62-L62) that if the ID is already set it calls `civicrm_api3_case_update`.
  
  `civicrm_api3_case_update` has no call to the `CRM_Case_BAO_Case::create` method, which is the only mention I see of custom parameter creation in the BAO.
  
  In fact api/v3/Case.php contains only one mention of the word "custom". It's surprising that something like this could have been left out and maybe I'm missing something, but when I tried creating a custom field for a Case locally and setting some custom values nothing was created.
  
  I'd suggest mentioning this in [Mattermost](https://chat.civicrm.org/civicrm/channels/user-support) or just going ahead and creating a bug report for it on [Jira](https://issues.civicrm.org/jira/)
  
  Edit:
  
  [This issue](https://issues.civicrm.org/jira/browse/CRM-18082) is about custom data being ignored by the case API but is still open.
  
  > **Comments:**
  > **username_3**: I am having the same issue.  I ended up just doing a query directly in the DB through the Drupal abstraction layer.  Not the best things but it works.  
  
  ---
  
  ### Answer by username_4 on 2017-08-16. Score: 0
  
  Unfortunately the Case API doesn't support custom fields... However, good news! From 4.7.25 the Case API DOES supports custom fields!
  <https://issues.civicrm.org/jira/browse/CRM-18082>
  
  
  ---
  
  