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

3 Answers 3


This looks like a bug to me. Looking at the code you can see in civicrm_api3_case_create 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 or just going ahead and creating a bug report for it on Jira


This issue is about custom data being ignored by the case API but is still open.

  • 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.
    – Josh
    Commented Aug 6, 2017 at 4:04

Not a direct answer to your question, but you might contemplate using CiviRules to update the case custom field?

  • 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. Commented Jul 13, 2017 at 10:01

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

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.