Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2405 of /var/www/drupal-7.50/includes/menu.inc).

CiviMail Custom Tokens

Tokens for custom fields in CiviMail are out-of-the-box, but sometimes a use-case calls for something more complicated. In this case we needed to send mail to exhibit booth contacts but include information filled out for their organization records. This effectively means include mailing tokens of a contact's organization information through a custom relationship type. This took a few tries to get just right. Conceptually, it's pretty simple for a Drupal installation - install as a Drupal module that calls CiviCRM hooks, call the API for what you need, and use the hooks to create tokens.

This was my first real CiviCRM customization, so it took a few tries to get everything right, including a proper try/catch block that logs errors, and the correct API calls (get VS getsingle).

The work can be found here, feel free to check out the most recent version here: https://github.com/elisseck/civi4.6-related-info-token

Image: 
Date: 
Thursday, August 11, 2016