From: Aidan Saunders Date: Fri, 14 Dec 2018 12:33:03 +0000 (+0000) Subject: getValue blows up if value is not set, so use getSingle instead X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e5e0c47b0e454a248364c83dc176472593ab31df;p=civicrm-core.git getValue blows up if value is not set, so use getSingle instead --- diff --git a/Civi/Token/TokenRow.php b/Civi/Token/TokenRow.php index 4f186d3d5c..efe5275f2a 100644 --- a/Civi/Token/TokenRow.php +++ b/Civi/Token/TokenRow.php @@ -136,10 +136,11 @@ class TokenRow { */ 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 ($fieldValue) {