Answers.Body: <p>The smarty variables for online and offline may be different for Contribution ID.</p>
  <p>For offline</p>
  <pre><code>{crmAPI var='rname' entity='Contribution' action='getvalue' return=&quot;custom_134&quot; id=`$contributionID`}
  {if $rname}&lt;p&gt;Dear {$rname},&lt;/p&gt;{else} &lt;p&gt;{contact.email_greeting},&lt;/p&gt; {/if}
  </code></pre>
  <p>Online</p>
  <pre><code>{crmAPI var='rname' entity='Contribution' action='getvalue' return=&quot;custom_134&quot; id=`$contributionID`}
  {if $rname}&lt;p&gt;Dear {$rname},&lt;/p&gt;{else} &lt;p&gt;{contact.email_greeting},&lt;/p&gt; {/if}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-16T20:16:10.337Z
Answers.Text: THanks, I switched the id to id=`$contributionID` and it worked
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-07-16T07:20:49.170Z
Answers.LastActivityDate: 2021-07-16T07:20:49.170Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I am having trouble with displaying a custom contribution field on the online reciept.</p>
  <p>With the offline receipt, it works great with this:</p>
  <pre><code>{crmAPI var='rname' entity='Contribution' action='getvalue' return=&quot;custom_134&quot; id=`$formValues.contribution_id`}
  {if $rname}&lt;p&gt;Dear {$rname},&lt;/p&gt;{else} &lt;p&gt;{contact.email_greeting},&lt;/p&gt; {/if}
  </code></pre>
  <p>The same code on the online receipt returns:</p>
  <p>Dear array,</p>
  <p>How can I fis this?</p>
  
Tags: <receipts><smarty>
Title: Displaying custom contribution field in the online receipt
ThreadText: # Displaying custom contribution field in the online receipt
  
  (Asked by: username_0 on 2021-07-16)
  
  I am having trouble with displaying a custom contribution field on the online reciept.
  
  With the offline receipt, it works great with this:
  
  ```
  {crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$formValues.contribution_id`}
  {if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}
  
  ```
  
  The same code on the online receipt returns:
  
  Dear array,
  
  How can I fis this?
  
  **Tags:** receipts, smarty
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-07-16. Score: 3 | Accepted answer
  
  The smarty variables for online and offline may be different for Contribution ID.
  
  For offline
  
  ```
  {crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$contributionID`}
  {if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}
  
  ```
  
  Online
  
  ```
  {crmAPI var='rname' entity='Contribution' action='getvalue' return="custom_134" id=`$contributionID`}
  {if $rname}<p>Dear {$rname},</p>{else} <p>{contact.email_greeting},</p> {/if}
  
  ```
  
  > **Comments:**
  > **username_0**: THanks, I switched the id to id=`$contributionID` and it worked  
  
  ---
  
  