Deleting custom values and custom_hook parameter $entity_id empty
Issue occured in CiviRules (https://github.com/CiviCooP/org.civicoop.civirules/issues/208)
The problem is that as soon as a record is deleted from a multi value custom group the hook civicrm_custom is called but
$entityId parameter is empty. This causes several errors in CiviRules as there is a trigger Custom Data Changed which assumes at least a contact id (which is this case the
create a custom data set for contacts that supports multiple records create a rule that triggers on custom data changing add a record to that custom data set for a contact delete the record observe the logs
This returns the error: "Expected one Contact but found 25" Traced to CRM/CivirulesPostTrigger/ContactCustomDataChanged.php where there is an api call to contacts getsingle. The issue is that when the custom data record is deleted, there is no remaining entity_id with which to retrieve the contact, and so no id is passed to the getsingle call.