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

How can I create a new card with multiple members by GAS

Deleted user July 19, 2020

In the following URL, It is enough to create a new card with multiple members by assigning a array whose element is the ID of members by strings.

https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post

---------------------------

idMembers

Array<string>

Comma-separated list of member IDs to add to the card

---------------------------

But, I can't create new card in this way, and the error is {"message":"Invalid objectId","error":"ERROR"} .

How can I create ? It is helpful to show a sample code to do this. 

 

My code is as follows:

 

var payload =
{"key": "XXXXXXXXXXXXXXXXXXXXXX", 
"token": "XXXXXXXXXXXXXXXXXXXXXX",
"idList" : "XXXXXXXXXXXXXXXXXXXXXX",
"name" : "aaa",
"idMembers": ["Mr. aaa","Mr. bbb"],

var option =
{"method":"POST",
"payload":payload
};

UrlFetchApp.fetch(URL,option);

1 answer

1 accepted

0 votes
Answer accepted
Iain Dooley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2020

@[deleted] the idMembers needs to be a comma separated list of member IDs, not member names or usernames. 

Here's an example written in Trellinator:

https://gist.github.com/iaindooley/20925ee9690aae643ad473622d1ff608

Here's the implementation of Card.create:

https://github.com/iaindooley/trellinator-libs/blob/master/Card.js#L1628

You can read more about Trellinator here:

https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Introducing-Trellinator-Automate-Trello-with-Google-Apps-Script/ba-p/925271

You can also try the above code snippet here:

https://app.benkobot.com/

Deleted user July 20, 2020

Thank you for your answer.

I have retried in the following way by referring URL above:

 

var payload =
{"key": "XXXXXXXXXXXXXXXXXXXXXX", 
"token": "XXXXXXXXXXXXXXXXXXXXXX",
"idList" : "XXXXXXXXXXXXXXXXXXXXXX",
"name" : "aaa",
"idMembers": "Mr. aaa's ID,Mr. bbb's ID", // not array

var option =
{"method":"POST",
"payload":payload
};

UrlFetchApp.fetch(URL,option);

 

In this way, no error has occurred and I can get the result what I wanted.

 

Very thank you !!

Like Iain Dooley likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events