I have templates that use a range of tokens from the contact and the case, including standard case tokens and custom fields. i.e.

{contact.display_name}   {case.id}   {case.subject}   {case.custom_154}

The case tokens are not processed when sending an email (via email activity)

They are processed on print/merge document. (via print/merge document activity)

Is this by design?


When sending email via email activity only contact tokens are supported. If you have Civicase token extension installed and enabled than you can pass caseid=34 (where 34 is case id) in activity email url

eg http://example.org/civicrm/activity/email/add?atype=3&action=add&reset=1&context=standalone&caseid=34
  • Yes, the token extension adds about 4 fields, but not the whole case columns, nor any extended case data. – Simon Walden Jun 4 '20 at 20:36

They work if you use the email icon in the roles section on manage case to initiate the email. They don't work if you use Contacts -> New Email from the general menu since it won't know what case it is.

  • I'm talking about emails sent from within the case - where it does not work - not even coded. – Simon Walden Jun 4 '20 at 20:35

OK, I'm really not sure why this has not been done. It was a handful of lines changed in 2 files to make this work.

It was so easy I'm concerned I'm missing something about why it was not setup in the first place.

the main change is in CRM/activity/BAO/activity.php which needs an extra argument to pass the case ID and then a few extra lines to for replaceCaseTokens(). Case_ID needs passing from messagetemplate.

If anyone needs this they can DM me for the details, its in test now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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