Answers.Body: <p>Since you are using getvalue, $result will be the contact's custom_13 value, so you don't need a foreach loop.</p>
  
  <p>Try using below snippet</p>
  
  <pre><code>{crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
  Custom 13: {$result}
  </code></pre>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-05T15:09:29.997Z
Answers.LastActivityDate: 2018-09-06T08:56:50.093Z
Answers.LastEditDate: 2018-09-06T08:56:50.093Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I'm absolutely embarrassed. I try to get value as it in <a href="https://civicrm.stackexchange.com/questions/125/how-can-i-add-rearrange-custom-fields-in-the-default-contact-view-template/26391">this thread</a> (and sorry for the wrong use of the topic). </p>
  
  <p>I try get a custom value via CRM API. With the API Explorer I can create the expression: </p>
  
  <pre><code>{crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
  {foreach from=$result.values item=contact}
    {$contact.some_field}
  {/foreach}
  </code></pre>
  
  <p>I can see the right result in the API Explorer. I insert it as it is into my tpl file, and I get back only the first character of the result. </p>
  
  <p>What do I wrong? </p>
  
Tags: <custom-fields><api>
Title: CRM API shows only the first char of the result?
ThreadText: # CRM API shows only the first char of the result?
  
  (Asked by: username_0 on 2018-09-05)
  
  I'm absolutely embarrassed. I try to get value as it in this thread (and sorry for the wrong use of the topic). 
  I try get a custom value via CRM API. With the API Explorer I can create the expression: 
  {crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
  {foreach from=$result.values item=contact}
    {$contact.some_field}
  {/foreach}
  
  I can see the right result in the API Explorer. I insert it as it is into my tpl file, and I get back only the first character of the result. 
  What do I wrong?
  
  **Tags:** custom-fields, api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-05. Score: 3 | Accepted answer
  
  Since you are using getvalue, $result will be the contact's custom_13 value, so you don't need a foreach loop.
  Try using below snippet
  {crmAPI var='result' entity='Contact' action='getvalue' sequential=0 return="custom_13" id=$contactId}
  Custom 13: {$result}
  
  Pradeep
  
  
  ---
  
  