Answers.Body: <p>Tokens aren't available in Search Kit.  You have a couple of choices:</p>
  <ul>
  <li>In CiviCRM 5.47, you can rewrite your Search Kit results using Smarty.  So you could recreate your token's logic in Smarty.</li>
  <li>If you have an unused Greeting Type field (e.g. &quot;Email Greeting Type&quot;), create a new greeting type that incorporates your token, and set all your contacts to use that greeting type.  Then you can use &quot;Email Greeting Type&quot; in your Search Kit results and get the same logic as your token.</li>
  </ul>
  <p>If you don't have a spare greeting type field, the <a href="https://docs.civicrm.org/moregreetings/en/latest/" rel="nofollow noreferrer">More Greetings</a> or <a href="https://github.com/MegaphoneJon/com.jlacey.salutations" rel="nofollow noreferrer">Salutations</a> extensions will provide them.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-09T15:52:35.723Z
Answers.Text: Jon G, Brilliant, thanks for the tip. I hadn't thought of adding the token into the Addressee field, and then displaying this field in SearchKit (actually, this works in ordinary searches too, but SK is a bit slicker). Again, many thanks.
Answers.UserDisplayName: Tom Crawshaw
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-07T17:32:16.930Z
Answers.LastActivityDate: 2022-03-07T17:32:16.930Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I've written a SearchKit search with Contacts and Related Contacts, and wish to combine the names into one field on output. I know I can use the Combine Text field transformation to simply add the fields together, but want to use a locally written mailmerge Token which programmatically alters the result (e.g. merging &quot;Mr John Smith&quot; and &quot;Mrs Jane Smith&quot; - same surname - to become &quot;John &amp; Jane Smith&quot;, or if the surnames are different, &quot;John Smith &amp; Jane Austen&quot;). How can I access Mailmerge tokens like this?</p>
  
Tags: <tokens><searchkit>
Title: Can I use tokens created with hook_civicrm_tokens to alter fields in SearchKit Displays?
ThreadText: # Can I use tokens created with hook_civicrm_tokens to alter fields in SearchKit Displays?
  
  (Asked by: username_0 on 2022-03-07)
  
  I've written a SearchKit search with Contacts and Related Contacts, and wish to combine the names into one field on output. I know I can use the Combine Text field transformation to simply add the fields together, but want to use a locally written mailmerge Token which programmatically alters the result (e.g. merging "Mr John Smith" and "Mrs Jane Smith" - same surname - to become "John & Jane Smith", or if the surnames are different, "John Smith & Jane Austen"). How can I access Mailmerge tokens like this?
  
  **Tags:** tokens, searchkit
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-03-07. Score: 1
  
  Tokens aren't available in Search Kit. You have a couple of choices:
  
  * In CiviCRM 5.47, you can rewrite your Search Kit results using Smarty. So you could recreate your token's logic in Smarty.
  * If you have an unused Greeting Type field (e.g. "Email Greeting Type"), create a new greeting type that incorporates your token, and set all your contacts to use that greeting type. Then you can use "Email Greeting Type" in your Search Kit results and get the same logic as your token.
  
  If you don't have a spare greeting type field, the [More Greetings](https://docs.civicrm.org/moregreetings/en/latest/) or [Salutations](https://github.com/MegaphoneJon/com.jlacey.salutations) extensions will provide them.
  
  > **Comments:**
  > **username_0**: Jon G, Brilliant, thanks for the tip. I hadn't thought of adding the token into the Addressee field, and then displaying this field in SearchKit (actually, this works in ordinary searches too, but SK is a bit slicker). Again, many thanks.  
  
  ---
  
  