The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the value of a custom field dropdown for a specific card?

geoffrey r_
November 11, 2020

How do I get the values for custom field dropdowns on a card?

When I query for custom fields and they're dropdowns, this is what I get

    "customFieldItems": [{
            "id": "5fa07bddf31c3b69d32d7564",
            "idValue": "5fa079eb3c04d6016ef994e3",
            "idCustomField": "5fa079eb3c04d6016ef994e2",
            "idModel": "5fa07a2956c88531d9d125be",
            "modelType": "card"
        },

 

I'm guessing I need to do something with idValue, but I have no clue how. The API docs don't really go into detail on dropdown custom fields.

 

 

This is one with a custom field date, and it has a clear value.

        {
            "id": "5fa07be5ad5b1f1ef10b73fe",
            "value": {
                "date": "2020-10-22T16:00:00.000Z"
            },
            "idCustomField": "5fa073a5eedccb1a273b7db2",
            "idModel": "5fa07a2956c88531d9d125be",
            "modelType": "card"
        }

 

I don't understand why the difference.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Cody
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 17, 2020

You're right, that's not entirely clear! I think it has to do with making Dropdown values flexible if they're changed at a later date. You'll need to cross-reference the idValue with the "id" of that option from the dropdown.

You can get both using a request like this:

GET https://api.trello.com/1/cards/{cardID}?key=...&token=...&customFieldItems=true&customFields=true

 Then you can compare like this:

 "customFieldItems": [
{
"id": "5fb404d66fe67d43442e640c",
"idValue": "5fb404ce868b9d54b61e9958",
"idCustomField": "5fb404c715857a51e549b2dc",
"idModel": "5fa07e5ce3ee8a01a53f18a1",
"modelType": "card"
},

And checking that against the "options" in the customFields response:

 {
"id": "5fb404ce868b9d54b61e9958",
"idCustomField": "5fb404c715857a51e549b2dc",
"value": {
"text": "drop3"
},
"color": "none",
"pos": 49152
}

 Once you find the ID that matches the idValue, the text attribute will tell you the actual value of that Dropdown that's shown to the user.

TAGS
AUG Leaders

Atlassian Community Events