Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Edited

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

0 votes
Cody C_ Atlassian Team Nov 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.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

339 views 14 12
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you