diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index 5a223beb33a3..cb5982f004bf 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -136,10 +136,11 @@ public function tokens($a = NULL, $b = NULL, $c = NULL) { */ public function customToken($entity, $customFieldID, $entityID) { $customFieldName = "custom_" . $customFieldID; - $fieldValue = civicrm_api3($entity, 'getvalue', array( + $record = civicrm_api3($entity, "getSingle", [ 'return' => $customFieldName, - 'id' => $entityID, - )); + 'id' => $entityID, + ]); + $fieldValue = \CRM_Utils_Array::value($customFieldName, $record, ''); // format the raw custom field value into proper display value if (isset($fieldValue)) {