Answers.Body: <p>You can use <a href="https://docs.civicrm.org/dev/en/latest/api/v4/usage/" rel="nofollow noreferrer">api 4</a> if you want to use as the name</p>
  <pre><code>$contacts = civicrm_api4('Contact', 'get', [
    'select' =&gt; [
      'constituent_information.Most_Important_Issue',
    ],
    'where' =&gt; [
      ['id', '=', 123],
    ],
  ]);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-03T18:29:41.973Z
Answers.LastActivityDate: 2021-05-03T18:29:41.973Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>if I want to get a value of a custom field, now I have to use <code>custom_xx</code>, like this:</p>
  <pre><code>$result = civicrm_api3('Contact', 'getvalue', [
     'return' =&gt; &quot;custom_11&quot;,
     'id' =&gt; 123,
  ]);
  </code></pre>
  <p>As <code>return</code> I'd like to use the name of field (<code>civicrm_custom_field.name</code>) instead of id. Is it possibile?</p>
  <p>Thanks.</p>
  
Tags: <custom-fields>
Title: Search custom field by name
ThreadText: # Search custom field by name
  
  (Asked by: username_0 on 2021-05-03)
  
  if I want to get a value of a custom field, now I have to use custom_xx, like this:
  $result = civicrm_api3('Contact', 'getvalue', [
     'return' => "custom_11",
     'id' => 123,
  ]);
  
  As return I'd like to use the name of field (civicrm_custom_field.name) instead of id. Is it possibile?
  Thanks.
  
  **Tags:** custom-fields
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-05-03. Score: 1 | Accepted answer
  
  You can use api 4 if you want to use as the name
  $contacts = civicrm_api4('Contact', 'get', [
    'select' => [
      'constituent_information.Most_Important_Issue',
    ],
    'where' => [
      ['id', '=', 123],
    ],
  ]);
  
  
  ---
  
  