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

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

Edited

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
milynnus
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 01, 2022

@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
AUG Leaders

Atlassian Community Events