I am using Civicoops Rules extension. In our boarding process I need to create a rule to create actions for contacts which are still in a certain group after 14 days. My idea was to use the daily trigger for groups and add a condition for the field created_date. How can I do this?

  • Should I use SQL as the compare value e.g. DATE_ADD(CURRENT_TIMESTAMP, INTERVAL 14 day)
  • Should I use PHP as the compare value e.g. strtotime('-14 days');
  • Should I create a custom condition as explained here

3 Answers 3


You may be able to achieve this already out of the box.

Create a rule like this:

  • Trigger: Contact added to group.
  • Condition: Contact is in group "the one you want"
  • Action: the desired action, with 14 days delay. Then check the box for rechecking of conditions. (You may also want to have an action of removing contact from the original group, so that the condition is no longer met, somewhere down the line...)
  • Thanks for this hint! I already tought about this, but only now realize the beauty of this solution. Because in fact I will also send reminders after 7 and after 28 days. It makes everything very simple as all these are in one single rule! But ...... 1. the group is a smart-group, do smart groups also trigger "Contact added to group" ? 2. I also tried trigger "Contact created" which would be fine in this use case, but the contacts are created by an extension trough the civicrm API. It seems CiviCRM API does not trigger contact created. Is this only done in UI? May 15, 2016 at 15:12
  • 1
    @AlainSchaefer Smart groups and CiviRules are generally not such a good match... But why not use a regular group, or even a tag. (I prefer tag, as it is easier to handle). Just test this real time, by choosing 7 and 28 minutes, instead of days:-)
    – Flying
    May 15, 2016 at 16:14
  • 1
    It may be very complicated, but you could have several Rules to achieve this. One could be with the trigger daily trigger of groups, and then add a tag (if not yet present). This could also apply for smart groups. Then you can follow up with a Rule with tag created, and 7 days delay as already explained. But of course, the more complicated the whole set-up is, the better it is to create a custom condition as @ErikH suggested
    – Flying
    May 15, 2016 at 16:21
  • thanks for the hint with the minutes, this will definitively help! Actually I just found that my problem is almost solved in #58. Just need to discover how to get this to work with timestamps as the field created_date is a timestamp. May 15, 2016 at 16:44

great to hear you are using CiviRules! Would be nice if you could take route 3 and do a PR so your action can be shared with other users too?

  • Good suggestion, will definitvely consider this. Btw, I am already preparing a small PR for the emailapi extension. May 15, 2016 at 15:36

After a small patch to CiviRules PR 70 the solution is to go route 2, but simply use "-2 weeks". In fact any string recognized by strtotime can be used.

  • Trigger: Daily trigger for group members
  • Condition: Field value comparision : created_date <= -2 weeks
  • Action: desired action, remove from Group

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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