Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix event custom field tokens in scheduled reminders #21374

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

ufundo
Copy link
Contributor

@ufundo ufundo commented Sep 5, 2021

Overview

Fix for rendering Event custom field tokens like {event.custom_123} in scheduled reminders for events

Before

The token processor looks up the value for the custom field using participant id rather than event id.

Generally this will be out of range and so the Scheduled Reminder job fails with Finished execution of Send Scheduled Reminders with result: Failure, Error message: Expected one Event but found 0

[I suppose it's possible it might hit a custom value from a random event in the co-incidence that participant_id matches some other event_id.]

After

{event.custom_123} tokens work as expected.

Technical Details

The line looks like a generalised look up for custom fields on $entity ( which is relevant when repeated in e.g.

$row->customToken($entity, $cfID, $actionSearchResult->entity_id);
) but I'm fairly confident in this context $entity is always 'Event' .

Comments

Looks like there are ambitious plans for TokenProcessor more generally, but hopeful this tiny fix could be useful in the interim.

@civibot
Copy link

civibot bot commented Sep 5, 2021

(Standard links)

@civibot civibot bot added the master label Sep 5, 2021
@eileenmcnaughton
Copy link
Contributor

I've put up a test here -#21563 - which makes this mergeable

@eileenmcnaughton eileenmcnaughton merged commit db6ad2c into civicrm:master Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants