1

I administer a CiviCRM site for an education NGO.

I'd like to be able to customize emails to let people know the school board and region we think they are in, so they're certain which event they should register for and if the school board is wronmg, to let us know. For each Individual, we know their employer (school board). For each school board, we know their region. I don't really want to directly assign a region to each individual as people change school boards not infrequently and there is a serious risk of this data becoming wrong. I can obviously access tokens for their name and employer, but I see no way to access the region of the employer.

Some searching here on StackExchange turned up an "Related Tokens" extension and civitoken which only includes a few things. I noticed in the extensions area "SearchKit Tokens", but I confess that SearchKit has remained pretty opaque for me. I love the idea, but getting anything like this out of it is beyond me. Is there a SearchKit tutorial somewhere that might get me on the road to a solution? I have failed to find anything more than a bare glimpse or high-level demo. Or is there a SearchKit afficionado who could describe the steps to get this out of SearchKit (and therefore SearchKit Tokens), educating myself in that backwards way?

UPDATE: I installed the Related-Tokens extension after all. It does work, contrary to my initial take. However, the SearchKit token solution given by @aidan below works great and keeps my token list a little simpler.

3
  • Not sure which you are saying is abandoned. civicrm.org/extensions/fuzion-tokens or civicrm.org/extensions/related-tokens or something else (assuming either of those give you what you need? Both contributors are still 'active', and often extensions can sit around for many years working perfectly, so the last 'release date' is not always a good indicator of whether an extension has been abandoned or not. Hope you find what you need.
    – petednz - fuzion
    Oct 11, 2023 at 19:07
  • have you tried ours? it also provides related contact tokens from memory
    – petednz - fuzion
    Oct 12, 2023 at 18:44
  • thanks @petednz-fuzion, I did review the docs for it, but it didn't seem to bring through custom fields for the related contact.
    – kapn
    Oct 27, 2023 at 8:45

1 Answer 1

3
  1. Install the 'SearchKit Tokens' extension.
  2. Read the README which has a full example.
  3. Go to Search > SearchKit then New Search
    • For your case, you want to create a search starting with Contact
    • In With, set the entity to Contact Related Contact and set the Relationship to contact as Employer of, and set Is Current to Yes (ie search for information about contacts and their current employers)
    • At the bottom if the page, click the Add dropdown. Go the end of that list and expand the Contact Related Contacts, choose the field you want to use (I've used City, you'll want your Region field). Remove the other fields you don't need. enter image description here
    • Click Search and check it is showing you what you expect.
    • On the left side, under Compose Search, click Add then Tokens.
    • Give your Region field a suitable label eg 'Employer Region'.
    • Give your search a name and Save enter image description here
  4. Test by going to a contact, click Actions then Print/Merge Document. In the Tokens box, find your token. Click Preview enter image description here

(Set up on https://dmaster.demo.civicrm.org until it rebuilds!)

1
  • Thanks Aidan. This was perfect!
    – kapn
    Oct 27, 2023 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.