It is possible to break Scheduled Reminder by adding too may entity types
How to reproduce
- Add about 100 activity types
- Create a Scheduled Reminder that triggers on Activity
- Select most or all activity types
- Save Scheduled Reminder
- Edit the recently created Scheduled Reminder, notice not all Activity Types are selected anymore
- Scheduled Reminders will begin failing
-Checking the Scheduled Job logs, the error will be
Finished execution of Send Scheduled Reminders with result: Failure, Error message: Failed encoding non-numeric value (#selectedValues)
The cause
The selected activity types are stored in the civicrm_action_schedule
table in the entity_value
column. This column only supports 255 characters. Adding any more characters than this causes the value to be truncated with an elipsis "..." at the end. This error originates from CRM_Activity_ActionMapping::createQuery
where the code places the trucated list of Activity Types into a where clause in a query. The "..." after the last value cause an integer check to fail.
How to fix
Convert this column to something longer? TEXT maybe? Happy to make a PR, but would like to know the preferred path.