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,300,850
Community Members
 
Community Events
165
Community Groups

How to set the idValue of a customField inside a customFieldItem array ? (Using GoogleScripts)

Edited
Filipe I'm New Here Apr 01, 2022

So i have a 'customFieldItems' array inside a certain card. So far i can acess any position of this array using the id of that position and using this url:

https://api.trello.com/1/cards/cardId/customFieldItems/customField_Id/?&key=api_key&token=api_token;

 

But inside this array there is a DropDown customField and i need to change the value of the selected option of this dropdown list(in my case this dropdown is in the position 1 of the 'customFieldItems' array).
I figured that the idValue is the id that i need to change but im not able to do that .
So far i got this:
var data = { "idValue""624460fc7dee1f1f8c5bce68" }; // This is the new id that i want to put
var options = {
    "method""put",
    "payload"data,
    "contentType""application/json"
  };

The URL: 

https://api.trello.com/1/cards/cardId/customFieldItems/customField_Id/?&key=api_key&token=api_token

 

var response = UrlFetchApp.fetch(url,options);

1 answer

1 accepted

1 vote
Answer accepted

@Filipe 

You might want to check the api. From my python wrapper code it seems that the structure of should be this ...where custom_field.id is the definition id

/card/' + self.id + '/customField/' + custom_field.id + '/item

and 

post_args = {'idValue': list_field_id}

the value of idValue is the id of the option you have in that CFD.

hey @milynnus  Your solution works ! Thank you!!

I addapted to the GoogleScripts like this : 

var id_Value ='IdValue here' ;

data = { "idValue"id_Value };
      options = {
        "method""put",
        "payload"JSON.stringify(data),
        "contentType""application/json"
      };
var key_and_token = "key=" + api_key + "&token=" + api_token;
var id_cfield = 'IdCustomField here';

var response =
UrlFetchApp.fetch(url + "cards/" + id_card + "/customField/" + id_cfield + 
"/item?&" + key_and_tokenoptions);
( Ive ommited the IDs but i think its clear how this works )

Suggest an answer

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

Taco Tuesday: New years' resolutions with Trello

Congratulations to @Laura Holton , our latest winner of Taco Tuesday! And thanks to @Kristján Geir Mathiesen for sharing the picture of Taco having fun with his new friend  B...

2,406 views 28 42
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