I may be blind but I can't see any api call to delete a custom value?!
CustomValue entity is missing a delete action.
What am I missing?
I may be blind but I can't see any api call to delete a custom value?!
CustomValue entity is missing a delete action.
What am I missing?
If you have the ID of the row you want to delete and the custom group ID you can use CRM_Core_BAO_CustomValue::deleteCustomValue
$dao = CRM_Core_BAO_CustomGroup::class;
$groupID = CRM_Core_DAO::getFieldValue($dao, 'Emergency_Contacts', 'id', 'name');
CRM_Core_BAO_CustomValue::deleteCustomValue($id, $groupID);
Which deletes an entire row from the custom value table for this custom group.
Currently, you can't do this. If you try, you will get the notice:
API (CustomValue, delete) does not exist (join the API team and implement it!)
This is true for CiviCRM version 4.7.7, which is current at time of writing.
API delete option for Custom value is missing in this version Please upgrade your Civicrm version to the latest version of Civicrm
please give a quick test http://d46.demo.civicrm.org/civicrm/api/explorer#explorer where you will find the delete action
Do you mean the value entered in a custom field, or an available option?
If the former, you should enter an empty string using custom_value.create
api.
For the latter, use option_value.delete
api.