Answers.Body: <p><em>Edit after reading email api code:</em>
  AFAICS, contributions should work. Please try a contribution token.</p>
  <p><em>Original:</em>
  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: <a href="https://lab.civicrm.org/dev/core/-/issues/1614" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/1614</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-02T04:08:05.230Z
Answers.Text: https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/  {contribution.custom_57} was what i was looking for. Thanks!
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-02T04:11:17.240Z
Answers.Text: <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>
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-01T18:29:59.253Z
Answers.LastActivityDate: 2021-09-01T19:06:20.657Z
Answers.LastEditDate: 2021-09-01T19:06:20.657Z
Answers.UserDisplayName: nielo
Body: <p>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?</p>
  <p>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.</p>
  <p>I found this thread which suggests using CiviRules <a href="https://civicrm.stackexchange.com/questions/31165/delay-automated-email-like-receipts">Delay automated email like receipts</a>   I can get a receipt from it but I have not figured out how to have the query find the related contribution data.</p>
  <p>Below is the the code I use for another message template but that draws the contribution data from a generated report.</p>
  <pre><code>    {foreach from=$contributions item=contribution} {assign
      var=&quot;date&quot; value=$contribution.receive_date|date_format:&quot;%B %d %Y&quot;}
  {crmAPI var='result' entity='LineItem' action='get' contribution_id=$contribution.id} 
    {foreach from=$result.values item=lineitem} 
      
    --&gt;
                      &lt;tr style=&quot;padding: 4px; border: 1px solid #281c1d;&quot;&gt;
                          &lt;td style=&quot;padding: 4px; border: 1px solid #281c1d;&quot;&gt;{$date}&lt;/td&gt;
                          &lt;td style=&quot;padding: 4px; border: 1px solid #281c1d;&quot;&gt;{$contribution.id}&lt;/td&gt;
                          &lt;td style=&quot;padding: 4px; border: 1px solid #281c1d;&quot;&gt;{$lineitem.label}&lt;/td&gt;
                          &lt;td style=&quot;text-align:right;padding: 4px; border: 1px solid #281c1d;&quot;&gt;$ {$lineitem.line_total}&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;!--
      {/foreach}{/foreach}
  </code></pre>
  
Tags: <civirules>
Title: Using CiviRules to send a receipt, how do I pull in the information from the contribution that trigged the action?
ThreadText: # Using CiviRules to send a receipt, how do I pull in the information from the contribution that trigged the action?
  
  (Asked by: username_0 on 2021-08-30)
  
  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} 
      
    -->
                      
                          {$date}
                          {$contribution.id}
                          {$lineitem.label}
                          $ {$lineitem.line_total}
                      
                      <!--
      {/foreach}{/foreach}
  </code>
  
  **Tags:** civirules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-01. Score: 1 | Accepted answer
  
  *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>
  
  > **Comments:**
  > **username_0**: https://docs.civicrm.org/user/en/latest/common-workflows/tokens-and-mail-merge/  {contribution.custom_57} was what i was looking for. Thanks!  
  > **username_0**: <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>  
  
  ---
  
  