1

When I do this:

$result = civicrm_api3('Participant', 'get', [
  'sequential' => 1,
  'return' => ["custom_14"],
  'event_id' => 3,
]);

In the results I get the desired custom field, but I also get all the other custom fields. At first I thought it's just the entire custom field set but then I tested it and it returns all the custom fields for participants no matter which field set they belong to.

 "is_error": 0,
    "version": 3,
    "count": 18,
    "values": [
        {
            "contact_id": "181",
            "participant_id": "46",
            "civicrm_value_ew_9_id": "1",
            "custom_14": "dsfa",
            "custom_14_1": "dsfa",
            "custom_15": "d",
            "custom_15_1": "d",
            "custom_16": "AAA",
            "custom_16_1": "AAA",
            "id": "46"
        },

The value I looked for is returned with civicrm_value prefix, but why is the other data displayed as well? Is this a bug or am I missing something? This seems to be the case for the Participant entity only.

I tested this on CiviCRM 5.9.1 and Michael McAndrew docker image with CiviCRM 5.11.alpha1.

1
  • 1
    Doesn't answer your question specifically, but there are inconsistencies in APIv3 and APIv4 aims to improve that.
    – Aidan
    Commented Feb 5, 2019 at 15:07

1 Answer 1

1

This is almost certainly a bug, but unlikely to be fixed in v3.

As Aidan mentioned - there are non-standard APIs in v3, and the Participant API is one of them, along with Contact and EntityTag.

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.