Answers.Body: <p>Pasting Adam's comment as the answer:</p>
  
  <p>OK, from my understanding after researching further, you can't retrieve/set custom fields via the case API - Thanks Brian! So basically I have to run multiple queries to get the data, which isn't efficient for large record sets. Hopefully one day I'll get the chance to add custom fields to standard entities on the API! In short, seperate your queries.. you can easily chain Case and Contact with the new API.. but need to get the IDs, and run a customvalue query with these IDs.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-29T12:55:19.403Z
Answers.LastActivityDate: 2015-05-29T12:55:19.403Z
Answers.UserDisplayName: Nicholai
Answers.Body: <p>I also noticed that  querying the API for custom fields does not  return  them  unless they are specified in the  return fields.  But the field that is  listed in the API explorer in not the actual field name,  I could not get the  fields  to return using their "title names"  but they do when using the custom_xx  field name.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-09T12:06:39.817Z
Answers.LastActivityDate: 2017-01-11T07:32:34.620Z
Answers.LastEditDate: 2017-01-11T07:32:34.620Z
Answers.UserDisplayName: CiviStackStu
Body: <p>I'm using CiviCRM 4.6 with the new API editor.</p>
  
  <p>I'm attempting to chain a bunch of queries together, which provide cases for a client within a period, along with the linked contact, along with custom data from the case entity, and the contact entity.</p>
  
  <p>I'm wondering the best way to chain this query together?
  The new case Entity allows retrieval of cases, by case type. If I chain the Contact entity to it via {"cid":"cid"} I obtain a list of client details... However both return just standard fields.</p>
  
  <p>If I enter return fields and select the custom fields, these do not appear in the final result.</p>
  
  <p>So what is the best way to query certain custom field values, which are specific to the case and client? i.e. A custom field ID#370 in Custom Field Group ID#55 for the client, which is a custom field attached to the case.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-23T13:32:03.720Z
Comments.Text: This is also via the external API (REST) i.e. with API key & site key
Comments.UserDisplayName: Adam
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-04-24T14:04:34.377Z
Comments.Text: OK, from my understanding after researching further, you can't retrieve/set custom fields via the case API - Thanks Brian! So basically I have to run multiple queries to get the data, which isn't efficient for large record sets. Hopefully one day I'll get the chance to add custom fields to standard entities on the API! In short, seperate your queries.. you can easily chain Case and Contact with the new API.. but need to get the IDs, and run a customvalue query with these IDs.
Comments.UserDisplayName: Adam
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-05-15T22:48:12.723Z
Comments.Text: Adam could you please post this comment as an answer instead of a comment? That will help others who come along to know that this question does have an answer.
Comments.UserDisplayName: Coleman
Tags: <api><custom-fields><chaining>
Title: CiviCRM API with Custom Data mixed with Standard Entities
ThreadText: # CiviCRM API with Custom Data mixed with Standard Entities
  
  (Asked by: username_0 on 2015-04-23)
  
  I'm using CiviCRM 4.6 with the new API editor.
  
  I'm attempting to chain a bunch of queries together, which provide cases for a client within a period, along with the linked contact, along with custom data from the case entity, and the contact entity.
  
  I'm wondering the best way to chain this query together?
  The new case Entity allows retrieval of cases, by case type. If I chain the Contact entity to it via {"cid":"cid"} I obtain a list of client details... However both return just standard fields.
  
  If I enter return fields and select the custom fields, these do not appear in the final result.
  
  So what is the best way to query certain custom field values, which are specific to the case and client? i.e. A custom field ID#370 in Custom Field Group ID#55 for the client, which is a custom field attached to the case.
  
  **Tags:** api, custom-fields, chaining
  
  > **Comments:**
  > **username_0**: This is also via the external API (REST) i.e. with API key & site key  
  > **username_0**: OK, from my understanding after researching further, you can't retrieve/set custom fields via the case API - Thanks Brian! So basically I have to run multiple queries to get the data, which isn't efficient for large record sets. Hopefully one day I'll get the chance to add custom fields to standard entities on the API! In short, seperate your queries.. you can easily chain Case and Contact with the new API.. but need to get the IDs, and run a customvalue query with these IDs.  
  > **username_1**: username_0 could you please post this comment as an answer instead of a comment? That will help others who come along to know that this question does have an answer.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-05-29. Score: 2 | Accepted answer
  
  Pasting username_0's comment as the answer:
  
  OK, from my understanding after researching further, you can't retrieve/set custom fields via the case API - Thanks Brian! So basically I have to run multiple queries to get the data, which isn't efficient for large record sets. Hopefully one day I'll get the chance to add custom fields to standard entities on the API! In short, seperate your queries.. you can easily chain Case and Contact with the new API.. but need to get the IDs, and run a customvalue query with these IDs.
  
  
  ---
  
  ### Answer by username_3 on 2017-01-09. Score: 3
  
  I also noticed that querying the API for custom fields does not return them unless they are specified in the return fields. But the field that is listed in the API explorer in not the actual field name, I could not get the fields to return using their "title names" but they do when using the custom\_xx field name.
  
  
  ---
  
  