Answers.Body: <p>This is a known issue: <a href="https://issues.civicrm.org/jira/browse/CRM-15915" rel="nofollow">CRM-15915</a>. I created a <a href="https://github.com/civicrm/civicrm-core/pull/5104" rel="nofollow">pull request</a> so that the format of your 1st example is used everywhere, but that pull request was closed in favour of <a href="https://github.com/civicrm/civicrm-core/pull/6430" rel="nofollow">another one</a>. This one still has some issues, as it seems.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-27T13:25:05.950Z
Answers.LastActivityDate: 2015-08-27T13:25:05.950Z
Answers.UserDisplayName: johanv
Answers.Body: <p>If the custom fields are of the same type, i think you should log an "Improvement" issue in <a href="https://issues.civicrm.org/jira" rel="nofollow">JIRA</a> for this. It's not really a bug but i think Api should be consistent.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-06T12:14:19.673Z
Answers.Text: Have done this: https://issues.civicrm.org/jira/browse/CRM-16464
Answers.UserDisplayName: DaveFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-08T15:54:27.133Z
Answers.LastActivityDate: 2015-04-08T15:54:27.133Z
Answers.UserDisplayName: samuelsov
Body: <p>I have contacts with an Alphanumeric/CheckBox custom field on, and I have relationships with an Alphanumeric/CheckBox custom field on. (The former is legacy and is copied into the latter.) These seem to be returned differently when using the getsingle API call. Why is this?</p>
  
  <p>For example:</p>
  
  <pre><code>$ drush -u &lt;uid&gt; cvapi Contact.getsingle id=&lt;cid&gt; contact_type=Individual contact_sub_type=Student return=custom_42
  Array
  (
      ...
      [custom_42] =&gt; Array
          (
              [0] =&gt; Fundraise_Donate_for_specific_school_needs
              [1] =&gt; Apply_to_become_a_Governor
              [2] =&gt; Be on a poster displayed in your old school/college
          )
      ...
  )
  </code></pre>
  
  <p>but:</p>
  
  <pre><code>$ drush -u &lt;uid&gt; cvapi Relationship.getsingle id=&lt;rid&gt; relationship_type_id=21 return=custom_112
  Array
  (
      ...
      [custom_112] =&gt; Array
          (
              [Fundraise_Donate_for_specific_school_needs] =&gt; 1
              [Apply_to_become_a_Governor] =&gt; 1
              [Be on a poster displayed in your old school/college] =&gt; 1
          )
      ...
  )
  </code></pre>
  
  <p>CustomValue.get, however, returns the same format for the Contact and the Relationship field, and that format is more like the Contact one above.</p>
  
Tags: <api><custom-fields>
Title: Why is format returned for multi-select custom field API different for Contact vs. Relationship?
ThreadText: # Why is format returned for multi-select custom field API different for Contact vs. Relationship?
  
  (Asked by: username_0 on 2015-04-07)
  
  I have contacts with an Alphanumeric/CheckBox custom field on, and I have relationships with an Alphanumeric/CheckBox custom field on. (The former is legacy and is copied into the latter.) These seem to be returned differently when using the getsingle API call. Why is this?
  
  For example:
  
  ```
  $ drush -u <uid> cvapi Contact.getsingle id=<cid> contact_type=Individual contact_sub_type=Student return=custom_42
  Array
  (
      ...
      [custom_42] => Array
          (
              [0] => Fundraise_Donate_for_specific_school_needs
              [1] => Apply_to_become_a_Governor
              [2] => Be on a poster displayed in your old school/college
          )
      ...
  )
  
  ```
  
  but:
  
  ```
  $ drush -u <uid> cvapi Relationship.getsingle id=<rid> relationship_type_id=21 return=custom_112
  Array
  (
      ...
      [custom_112] => Array
          (
              [Fundraise_Donate_for_specific_school_needs] => 1
              [Apply_to_become_a_Governor] => 1
              [Be on a poster displayed in your old school/college] => 1
          )
      ...
  )
  
  ```
  
  CustomValue.get, however, returns the same format for the Contact and the Relationship field, and that format is more like the Contact one above.
  
  **Tags:** api, custom-fields
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-08-27. Score: 1 | Accepted answer
  
  This is a known issue: [CRM-15915](https://issues.civicrm.org/jira/browse/CRM-15915). I created a [pull request](https://github.com/civicrm/civicrm-core/pull/5104) so that the format of your 1st example is used everywhere, but that pull request was closed in favour of [another one](https://github.com/civicrm/civicrm-core/pull/6430). This one still has some issues, as it seems.
  
  
  ---
  
  ### Answer by username_2 on 2015-04-08. Score: 1
  
  If the custom fields are of the same type, i think you should log an "Improvement" issue in [JIRA](https://issues.civicrm.org/jira) for this. It's not really a bug but i think Api should be consistent.
  
  > **Comments:**
  > **username_0**: Have done this: https://issues.civicrm.org/jira/browse/CRM-16464  
  
  ---
  
  