From caf97485bf39f1fa5cadcc09833c59016074df66 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 1 Nov 2021 11:09:24 +1300 Subject: [PATCH] Handling for intermittent Im->getfields error I'm not quite sure when this started but I've been seeing Im->getfields not found errors of late - this helps --- CRM/Contact/Tokens.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Contact/Tokens.php b/CRM/Contact/Tokens.php index a713d8cc25..5742945dd3 100644 --- a/CRM/Contact/Tokens.php +++ b/CRM/Contact/Tokens.php @@ -380,6 +380,9 @@ class CRM_Contact_Tokens extends CRM_Core_EntityTokens { foreach ($this->getRelatedEntityTokenMetadata() as $entity => $exposedFields) { $apiEntity = ($entity === 'openid') ? 'OpenID' : ucfirst($entity); + if ($apiEntity === 'Im') { + $apiEntity = 'IM'; + } $metadata = (array) civicrm_api4($apiEntity, 'getfields', ['checkPermissions' => FALSE], 'name'); foreach ($metadata as $field) { $this->addFieldToTokenMetadata($tokensMetadata, $field, $exposedFields, 'primary_' . $entity); -- 2.25.1