4

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.

3
  • This is also via the external API (REST) i.e. with API key & site key
    – Adam
    Commented Apr 23, 2015 at 13:32
  • 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.
    – Adam
    Commented Apr 24, 2015 at 14:04
  • 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.
    – Coleman
    Commented May 15, 2015 at 22:48

2 Answers 2

2

Pasting Adam'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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.