1

Short question: I have a CiviRule: Trigger is Contribution Added, Action is Send Email with the message selected to use a User Driven Message Template. How do I get the triggering Contribution details available to be used in the message?

Longer Question: We have a custom field from a WebformCiviCRM Integration form that we would like to have shown on the receipt. But it appears that the receipt is created and sent before the contribution process finishes writing to the custom table. I want to delay the receipt creation process by 1-2 minutes.

I found this thread which suggests using CiviRules Delay automated email like receipts I can get a receipt from it but I have not figured out how to have the query find the related contribution data.

Below is the the code I use for another message template but that draws the contribution data from a generated report.

    {foreach from=$contributions item=contribution} {assign
    var="date" value=$contribution.receive_date|date_format:"%B %d %Y"}
{crmAPI var='result' entity='LineItem' action='get' contribution_id=$contribution.id} 
  {foreach from=$result.values item=lineitem} 
    
  -->
                    <tr style="padding: 4px; border: 1px solid #281c1d;">
                        <td style="padding: 4px; border: 1px solid #281c1d;">{$date}</td>
                        <td style="padding: 4px; border: 1px solid #281c1d;">{$contribution.id}</td>
                        <td style="padding: 4px; border: 1px solid #281c1d;">{$lineitem.label}</td>
                        <td style="text-align:right;padding: 4px; border: 1px solid #281c1d;">$ {$lineitem.line_total}</td>
                    </tr>
                    <!--
    {/foreach}{/foreach}
1

Edit after reading email api code: AFAICS, contributions should work. Please try a contribution token.

Original: I'm afraid you have to code a new action maybe by extending the send-email-action to add the context. I'm having the same problem with a case and will tell you if I succeed. Token processing is WIP: https://lab.civicrm.org/dev/core/-/issues/1614

2
  • docs.civicrm.org/user/en/latest/common-workflows/… {contribution.custom_57} was what i was looking for. Thanks!
    – Iowa Boy
    Sep 2 at 4:08
  • <tr style="padding: 4px; border: 1px solid #281c1d;"> <td style="padding: 4px; border: 1px solid #281c1d;">{contribution.receive_date}</td> <td style="padding: 4px; border: 1px solid #281c1d;">{contribution.id}</td> <td style="padding: 4px; border: 1px solid #281c1d;">{contribution.custom_57}</td> <td style="text-align:right;padding: 4px; border: 1px solid #281c1d;"> {contribution.total_amount}</td> </tr>
    – Iowa Boy
    Sep 2 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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