How to retrieve drilldown custom field actual value using the API

I have an internal form with a drilldown custom field for the user to select different broker.
I tried to use the API to pull the drilldown custom field value. It doesn’t send back the field value instead it returns an id.

00 am

$con = $this->app->loadCon($contactid, [’_Broker0’]);
Return {"_Broker0": 49}

I queried the DataFormField table and couldn’t find any field related to the id 49.
$data = $this->app->dsQuery(‘DataFormField’, 1,0, [‘Name’ => ‘Broker0’], [‘Values’, ‘ListRows’, ‘DataType’, ‘Label’, ‘FormId’, ‘GroupId’, ‘Id’, ‘DefaultValue’, ‘Name’]);

[{
“Label”: “Broker”,
“Values”: [{
“Broker2”: [“broker2@email.com”]
}, {
“Broker3”: [“broker3@email.com”]
}, {
“Broker1”: [“broker1@email.com”]
}],
“ListRows”: 0,
“DataType”: 23,
“FormId”: -1,
“Id”: 305,
“GroupId”: 19,
“Name”: “Broker0”
}]

Is there a way I can get the actual value (broker1@email.com) out of the drilldown custom field?

Didn’t we already have this conversation on FB? lol

Yes. We did.

I asked the question here because I want to see if anyone will have a proper solution.

The one I have is more like a hacked solution and it also takes up extra action in Zapier which I don’t really like it. It eats up usage very quickly.

Well, you’re of course welcome to but the id being sent by IS is still going to be the same. There really isn’t any way around that. Believe me, I wish there were :wink:

Hi @Kin_Lok_Wong, I don’t believe there is a way to relate the drilldown option id and label using XML-RPC. However, the REST contact custom fields endpoint will return this metadata about drilldown custom fields. Here is an example response showing the drilldown hierarchy.

[{
  "id": 26,
  "label": "Drilldown Field Test",
  "options": [
    {
      "id": "2",
      "label": "Dogs",
      "options": [
        {
          "id": "4",
          "label": "Chow",
          "options": []
        },
        {
          "id": "6",
          "label": "Retriever",
          "options": []
        }
      ]
    },
    {
      "id": "10",
      "label": "Cats",
      "options": [
        {
          "id": "12",
          "label": "Maine Coon",
          "options": []
        },
        {
          "id": "14",
          "label": "Bengal",
          "options": []
        }
      ]
    }
  ],
  "field_type": "Drilldown"
}]

Thanks Nicholas. This is great.
24 am

No problem, happy to help!

I just wanted to add here that, while the information we need was found somewhere, it is not great to be using an interface that is supposed to be solid (XML-RPC) only to find missing data and having to resort to another interface (REST, when it works) to complete that.

This is quite crazy, not exactly great.

Actually, not only the response I mentioned sounds a bit hackish (changing endpoints because the “reliable” one doesn’t include the correct data), but it’s also a bit misleading.

This post asks for “retrieve drilldown custom field values”, but the response mentions the Contact custom fields. What about other tables? The REST SDK have a misleading method called customfields() which actually retrieves only Contact fields… I’m looking for information about Opportunities - and I didn’t find that on the REST Docs as well.

I guess I’m still stuck with an incomplete API both on RPC and REST?

The REST implementation will not receive custom fields from any other object than what it’s called on. The contact fields are on the contact object…this should be obvious. Since REST does not yet retrieve custom fields on the opportunity object (unless docs have not yet been updated but I don’t believe that to be the case), or any of the other 5 remaining custom field enabled objects, those are not available through REST. They are available through the standard API using RPC calls. These use the same OAuth access token and they are not planned for sun setting so there is no compelling reason not to do so while we wait for further REST development.

While they’re indeed available on the RPC API, there’s no way to link
actual string values to the IDs sent by the API - and that’s the whole
point of this topic.
That’s possible using the REST endpoint as described before, but only for
Contacts - as you mentioned, other custom fields are not yet available, and
the RPC API is certainly incomplete in this area.

Use the api to read the FormDataField table. Your name and id associations can be found there.

Hi @igor.santos, I’m sorry for the misunderstanding around accessing drilldown custom field options via the API. It is currently not possible to access drilldown options via the XML-RPC API; they are stored in a different table that is not exposed.

Last year we added a new endpoint to access contact custom fields via the REST API. This endpoint includes drilldown options and can be used to access all metadata around contact custom fields. However, we have not yet added the remaining REST endpoints to support other resource custom fields like opportunities.

I will add stories to our backlog to finish out the remaining REST endpoints to return custom fields for other resources as well as adding support for getting/setting custom field values on the corresponding resources.

Cool!

Glad to know this will be looked into.

Just out of curiosity, the RPC API won’t receive new features, not even
missing things like the drilldown fields, right?

– Igor Santos
Fullstack freelancer & Community Leader @ Toptal
http://www.toptal.com/#obtain-only-eye-opening-coders-now

Correct, we are keeping our focus on REST and only modifying XML-RPC when necessary such as fixing critical bugs.

Any update on this, now that 18 months have passed?