1

I am using CiviCRM 5.13.4 and CiviRules 2.9.

I am using CiviRules to send an email to Contacts when they sign up for a Membership, but do so using 'Pay Later', to remind them how to pay etc. The sign-up is via a Webform, but I'm not sure that matters.

The rule is set up to fire on 'Contribution Added', tests for the 'Pending' status and sends the Email - which all works OK. The email uses a Template which contains (custom) tokens which fill in the Membership Type and Price into the text to be sent.

If I test this Template in a static environment, i.e. some time after the payment was made it works correctly, but when triggered by the Rule those Tokens just return empty. I strongly suspect that this is because when the rule fires the Contribution record has been added to the database, but the Line Items which connect it to the Membership information have not yet been created.

When does the 'Membership Payment Added' trigger fire, and would it solve my problem? Or is there another way?

Thank You.

2 Answers 2

2

I had this issue too with event registrations, I added a five minute delay to the civirule and it seemed to clear up that issue.

1
  • Yes - I used that technique in another similar situation. The only problem is that '5 minutes' actually means 'cron interval plus up to 5 minutes', and I would like the system to be more responsive than that from the end user's point of view. It looks as if I may have to live with it though. Tony Sep 23, 2019 at 10:56
1

The MembershipPayment Added trigger should fire on the post hook, which might in some cases (notably the memberships and cases) mean the data is not complete yet (see this issue: https://lab.civicrm.org/extensions/civirules/issues/21).

8
  • I certainly seem to be getting the problem described here. Unless there is a workaround I haven't thought of? Tony Sep 23, 2019 at 10:57
  • Can you try if there is another entity you could trigger on that is fired when the data is complete? Sep 23, 2019 at 11:23
  • I think the final link in the chain is the Line Item, which connects the Membership to the Contribution record, but there is no Trigger provided on Line Item. If you can suggest anything else I would be happy to try it. Tony. Sep 25, 2019 at 10:57
  • LineItem is indeed not a trigger. I assume you have had a go with the Membership Payment? If that does not work then I have no solution until the mentioned issue 21 is fixed. Sep 25, 2019 at 16:17
  • I have now tried triggering on Membership Payment, which fails. Looking at the $triggerdata which is passed to the Action it has a Contact Id of 0, so any subsequent action on the Contact, such as sending them an email, throws an error. Tony. Sep 28, 2019 at 18:31

Your Answer

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

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