Answers.Body: <p>I think the issue would indeed be that there are no participants, so therefore no events joined and an empty start_date. Can you try with a participant?</p>
  <p>If the issue persists can you please report it as a bug on the Civirules extension page (<a href="https://lab.civicrm.org/extensions?utf8=%E2%9C%93&amp;filter=civirules" rel="nofollow noreferrer">https://lab.civicrm.org/extensions?utf8=%E2%9C%93&amp;filter=civirules</a>)? Would fixing it be possible for you?</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-28T19:36:24.077Z
Answers.Text: I tried with participants, but got a different crash.  Issue added as you suggested. I don't have the PHP skills to fix, sorry.
Answers.UserDisplayName: Andy Clark
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-29T06:46:22.510Z
Answers.Text: No worries...might well be that others run into the same problems so it gets fixed. Or you'd have to wait until the next CiviRules sprint that CiviCooP does (not scheduled yet)
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-28T15:09:15.910Z
Answers.LastActivityDate: 2020-09-28T15:09:15.910Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>The user wants to send a recurring email - twice a week on successive days. So I set up a recurring event and then added a CiviRule with the trigger 'Event date reached'.  The event didn't trigger because of the following crash - it doesn't have any participants, could this be the problem?</p>
  <pre><code>SELECT `p`.*
          FROM `civicrm_participant` `p`
          INNER JOIN `civicrm_event` `e` ON `e`.`id` = `p`.`event_id`
          LEFT JOIN `civirule_rule_log` `rule_log` ON `rule_log`.entity_table = 'civicrm_participant' AND `rule_log`.entity_id = p.id AND `rule_log`.`contact_id` = `p`.`contact_id` AND DATE(`rule_log`.`log_date`) = DATE(NOW())  AND `rule_log`.`rule_id` = %3
          WHERE DATE(`e`.`start_date`) = CURDATE()
          AND `rule_log`.`id` IS NULL
          AND `e`.`event_type_id` = 12
          AND `p`.`contact_id` NOT IN (
            SELECT `rule_log2`.`contact_id`
            FROM `civirule_rule_log` `rule_log2`
            WHERE `rule_log2`.`rule_id` = %3 AND DATE(`rule_log2`.`log_date`) = DATE(NOW()) and `rule_log2`.`entity_table` IS NULL AND `rule_log2`.`entity_id` IS NULL
          ) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%3
          WHERE DATE(`e`.`start_date`) = CURDATE()
          AND `rule...' at line 4]
  </code></pre>
  <p>I'd like to understand how to get this working, and also if anyone has a suggestion of an alternative way of achieving this?</p>
  
Tags: <civirules>
Title: CiviRules not triggering event reached date
ThreadText: # CiviRules not triggering event reached date
  
  (Asked by: username_0 on 2020-09-28)
  
  The user wants to send a recurring email - twice a week on successive days. So I set up a recurring event and then added a CiviRule with the trigger 'Event date reached'. The event didn't trigger because of the following crash - it doesn't have any participants, could this be the problem?
  
  ```
  SELECT `p`.*
          FROM `civicrm_participant` `p`
          INNER JOIN `civicrm_event` `e` ON `e`.`id` = `p`.`event_id`
          LEFT JOIN `civirule_rule_log` `rule_log` ON `rule_log`.entity_table = 'civicrm_participant' AND `rule_log`.entity_id = p.id AND `rule_log`.`contact_id` = `p`.`contact_id` AND DATE(`rule_log`.`log_date`) = DATE(NOW())  AND `rule_log`.`rule_id` = %3
          WHERE DATE(`e`.`start_date`) = CURDATE()
          AND `rule_log`.`id` IS NULL
          AND `e`.`event_type_id` = 12
          AND `p`.`contact_id` NOT IN (
            SELECT `rule_log2`.`contact_id`
            FROM `civirule_rule_log` `rule_log2`
            WHERE `rule_log2`.`rule_id` = %3 AND DATE(`rule_log2`.`log_date`) = DATE(NOW()) and `rule_log2`.`entity_table` IS NULL AND `rule_log2`.`entity_id` IS NULL
          ) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '%3
          WHERE DATE(`e`.`start_date`) = CURDATE()
          AND `rule...' at line 4]
  
  ```
  
  I'd like to understand how to get this working, and also if anyone has a suggestion of an alternative way of achieving this?
  
  **Tags:** civirules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-09-28. Score: 0
  
  I think the issue would indeed be that there are no participants, so therefore no events joined and an empty start\_date. Can you try with a participant?
  
  If the issue persists can you please report it as a bug on the Civirules extension page (<https://lab.civicrm.org/extensions?utf8=%E2%9C%93&filter=civirules>)? Would fixing it be possible for you?
  
  > **Comments:**
  > **username_0**: I tried with participants, but got a different crash.  Issue added as you suggested. I don't have the PHP skills to fix, sorry.  
  > **username_1**: No worries...might well be that others run into the same problems so it gets fixed. Or you'd have to wait until the next CiviRules sprint that username_1 does (not scheduled yet)  
  
  ---
  
  