Open Upperholme opened 4 years ago
I have a feeling they don't work from there - @jitendrapurohit ring any bells?
But they do work in Scheduled reminders, right?
I believe so...
Sorry for being late, but it seems mailing and a normal email from a contact screen loads all contact-related tokens on the widget. In this case, you should be able to use the tokens that can be retrieved based on some condition from a contact id. Eg I see a list of custom membership tokens on a site using this ext (New Mailing)
I'd agree that you should be able to use the tokens that can be retrieved. i.e. if the user can see the token in the list, it should be usable. If it isn't usable (ie. doesn't work in that context) then it shouldn't appear in the list. Not sure how that might be managed in practice, but in terms of UX it seems fair.
If it isn't usable (ie. doesn't work in that context) then it shouldn't appear in the list
I think this is what is the current behavior. Do you mean you've used the token from the above list and it wasn't evaluated to the required value?
That's correct. I set up bulk mailing to a group of contacts that I had previously selected based on some membership criteria. The goal was to include their membership expiration date in the message that was sent to them. The tokens were available in the UI when composing the bulk mailing, so the assumption was that they would be evaluated.
The message was sent, but the tokens were not evaluated. Net result being that the recipients received a confusing message that did not include the date as planned.
This type of messages would normally be handled in a scheduled reminder, but in this case that had been disabled for a period of time and so the decision was taken to use a bulk email and select the target group based on the relevant membership criteria.
Bump... I'm having a version of this issue. The Member tokens aren't evaluating. I have a basic email template with them and if I send from the contact (email to one contact) the other tokens (first name, cid, etc) evaluate but the {latestcurrentmembership.type} and {latestcurrentmembership.end_date} don't evaluate (although, the token itself isn't printed).
Any suggestions on how to help it along?
CiviCRM 5.45.1 & Drupal 9.3.3
Adding another comment
Membership tokens
{latestcurrentmembership.alltype} {latestcurrentmembership.allend_date} {latestcurrentmembership.type} {latestcurrentmembership.end_date}
Will evaluate when you send an email to a contact, but fail to evaluate (expand) when sent as a scheduled reminder.
I am showing nothing in the logs (I was hoping for a smarty failure)
The client advises this has been working for quite some time. Any suggestions on what can be done? We can offer paid support. I just need to see how much the client can afford.
@kcristiano do core contact tokens work in the same context?
@eileenmcnaughton all other tokens are working. Sorry for leaving that out.
@kcristiano - does it work without the return
in here https://github.com/eileenmcnaughton/nz.co.fuzion.civitoken/blob/9e1fb11b45c39ab2063bcda62857e1b45cfe9bf8/Civi/Token/CiviTokens.php#L122-L124
This might work
diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php
index 6f9d8ea9c4..2c49bc33b6 100644
--- a/CRM/Core/BAO/ActionSchedule.php
+++ b/CRM/Core/BAO/ActionSchedule.php
@@ -641,6 +641,7 @@ FROM civicrm_action_schedule cas
'actionSchedule' => $schedule,
'actionMapping' => $mapping,
'smarty' => TRUE,
+ 'schema' => ['contactId'],
]);
$tp->addMessage('body_text', $schedule->body_text, 'text/plain');
$tp->addMessage('body_html', $schedule->body_html, 'text/html');
Thanks I'll try these and report back.
@eileenmcnaughton I left both changes in and the tokens (membership and core) all expanded.
Do you think we need both changes? I am now inclined to test one by one. What do you think?
yeah - I think the core one is probably right
@eileenmcnaughton I agree the core one makes the most sense. I've tested with just the core change and the tokens (both core and custom) work.
do you want to put it up as a PR?
I'm trying to use the membership end date tokens in a bulk mailing. They don't appear to work. However when I use them in an email to a specific contact, they do work. Is this a bug or am I doing something wrong, or making a schoolboy error? CiviCRM version 5.27.4