twomice / com.joineryhq.reltoken

CiviCRM extension: Provides tokens for any related contact, for all available contact tokens. E.g., to get the spouse's first name, or parent's marriage date.
Other
1 stars 5 forks source link

Related Tokens

Provides tokens for any related contact, for all available contact tokens. E.g., to get the spouse's first name, or parent's marriage date.

Configuration

Upon installation, this extension will create a custom field, Generate tokens for this relationship type, on each relationship type (see screenshot): Screenshot

This field defaults to Yes; set this field to No on any relationship types for which you don't want this extension to provide tokens.

Usage

Similar extensions

Whereas "Related Tokens" adds all available tokens -- including all custom fields and other fields, as explained above -- for each relationship type, the "CiviToken" extension adds only 6 tokens (Display Name, First Name, Last Name, Phone, Email, Contact ID) for each relationship type, along with a variety of other customized tokens not derived from relationships.

Tech details

  1. Token strings are built from the values of civicrm_relationship_type.name_a_b and civicrm_relationship_type.name_b_a. These values are normally fairly stable, and this approach aims to avoid problems in dev/stage/prod environments where relationship type IDs could differ from system to system.

Room for improvement

This extension could be improved in many ways; here are some I've thought of but not yet implemented:

  1. Provide more control or better defaults for what happens when a contact has more than one relationship of a given type. For example, many contacts may have more than one "Parent/Child", and the Related (Child)::First Name token obviously falls short here; at present it will use the relationship with the highest internal ID (typically the one most recently created), but it could be more desirable in various situations to use the one with the newest start date, or to concatenate them all into a comma-separated string, or any number of other things.
  2. Perhaps there are other tokens that should be supported as well; suggestions are welcome.

Support

screenshot

Joinery provides services for CiviCRM including custom extension development, training, data migrations, and more. We aim to keep this extension in good working order, and will do our best to respond appropriately to issues reported on its github issue queue. In addition, if you require urgent or highly customized improvements to this extension, we may suggest conducting a fee-based project under our standard commercial terms. In any case, the place to start is the github issue queue -- let us hear what you need and we'll be glad to help however we can.

And, if you need help with any other aspect of CiviCRM -- from hosting to custom development to strategic consultation and more -- please contact us directly via https://joineryhq.com