Answers.Body: <p>If you can get campaign id ({$formValues.campaign_id}) then you can use api to retrieve the Campaign Title. Use below snippet to get the Title</p>
  
  <pre><code>{if $formValues.campaign_id} 
  
    {crmAPI var='campaignTitle' entity='Campaign' action='getvalue' sequential=0 return="title" id="`$formValues.campaign_id`"}
    {$campaignTitle}
  {/if}
  </code></pre>
  
  <blockquote>
    <p><strong>Note</strong>: The snippet code is not tested but you can use the logic to get
    the title</p>
  </blockquote>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-06T23:05:09.773Z
Answers.Text: thanks for the response. I tried this but it prints: Array
  It seems to work in the API explorer but not in the template
Answers.UserDisplayName: Yossi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-07T06:54:45.410Z
Answers.Text: It does work we need use right variable
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-07T21:14:24.380Z
Answers.Text: Updated my answer
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-06T09:00:24.407Z
Answers.LastActivityDate: 2019-06-07T21:14:17.097Z
Answers.LastEditDate: 2019-06-07T21:14:17.097Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Trying to add the campaign name to my automatic receipts.</p>
  
  <p>This works: {$formValues.campaign_id}</p>
  
  <p>But this doesn't: {$formValues.campaign_name} or {$formValues.campaign_title}</p>
  
  <p>I need to print the campaign name and not id. </p>
  
  <p>How can I add the Campaign name to my receipt</p>
  
Tags: <receipts>
Title: How to add Campaign token in system contribution receipt
ThreadText: # How to add Campaign token in system contribution receipt
  
  (Asked by: username_0 on 2019-06-06)
  
  Trying to add the campaign name to my automatic receipts.
  
  This works: {$formValues.campaign\_id}
  
  But this doesn't: {$formValues.campaign\_name} or {$formValues.campaign\_title}
  
  I need to print the campaign name and not id.
  
  How can I add the Campaign name to my receipt
  
  **Tags:** receipts
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-06-06. Score: 3 | Accepted answer
  
  If you can get campaign id ({$formValues.campaign\_id}) then you can use api to retrieve the Campaign Title. Use below snippet to get the Title
  
  ```
  {if $formValues.campaign_id} 
  
    {crmAPI var='campaignTitle' entity='Campaign' action='getvalue' sequential=0 return="title" id="`$formValues.campaign_id`"}
    {$campaignTitle}
  {/if}
  
  ```
  
  > **Note**: The snippet code is not tested but you can use the logic to get
  > the title
  
  HTH
  
  username_1
  
  > **Comments:**
  > **username_0**: thanks for the response. I tried this but it prints: Array It seems to work in the API explorer but not in the template  
  > **username_1**: It does work we need use right variable  
  > **username_1**: Updated my answer  
  
  ---
  
  