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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,333
Community Members
 
Community Events
176
Community Groups

Trello API: How do I accurately get the value of a Custom Field?

Hello :)

First time posting, thank you for any help & guidance. 

I'm attempting to store custom field values using GET /1/cards/{id}/customFieldItems 

My problem is that the order of the custom fields response is inconsistent, meaning my bracket notation to access the value is unreliable as the fields do not appear in the same position. 

value = response[0]['value']['number'];

Please see screenshot which shows the response of 4 separate cards in a list. 

Screen Shot 2022-02-09 at 7.24.28 pm.png

Can someone please provide some knowledge as to why this happens and any options I may have to get around it?

Thank you very much!

2 answers

0 votes
Felix Atlassian Team Feb 09, 2022

Hey @Jake - this is a bit unfortunate, and we should probably be sorting the field items before returning them.

Nevertheless, you will have to rely on the idCustomField value to tell you which custom field the custom field item value refers.

Basically, you have the "customFields" which can be retrieved from /1/boards/:id/customFields, which is the definition of the fields (name, type, position, id).

That definition (the "customField") is what the customFieldItem.idCustomField refers to, and what you'll need to use to match up which customField the customFieldItem provides a value for.

Sidenote: there's also an Atlassian Developer Community (https://community.developer.atlassian.com/), where API questions might be answered more quickly.

 

Felix

Thank you very much Felix, I'll try to implement this and report back :)

 

I appreciate the response! 

 

Jake

0 votes
milynnus Rising Star Feb 09, 2022

@Jake 

Would get by custom_field by name a better bet ...not sure this would work...you can try it

next(cf for cf in card_cf_list if cf['name'] == req_field_name)

(note...did not test code)

Thanks @milynnus I'll let you know how i go :)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events