Recovering comments from a copied card (via API)

Hey everyone - hope someone can help here…

I’m trying to pull comments from cards in a number of boards, but have just experienced an issue with getting the comments from cards that are copied.

The script I have works this way (and for the most part is fine)
Obtain all the cards id’s in the board
Query the card actions for comment data
dump out the comment and card id into a csv.

The issue is, if someone has copied a card in a board, it has no comment data.

If I had a new comment, that will be picked up, but not the comment that was in the card when it was copied…

Anyone have any ideas?

THANKS!

Hello @GaryLiddington

You have accidentally stumbled on a particular aspect of Trello’s behaviour that has never made much sense to me.

When a card is copied, along with its comments, that copying process isn’t recorded as an Action… the comments just ‘somehow get there’ :slight_smile: . You can see those copied comments in the copied card via the GUI, along with the information about who performed the copy and who made the original comment, but if you use the REST API to get all the commentCard Actions on that card, nothing is found :frowning: , only new comments made thereafter can be found as new Actions.

Since Trello doesn’t have a formal bug reporting process, this is just one of those questions that comes up every now and then.

Hopefully one of the Trello dev team read this and can provide an explanation.

Hiya @sunnyape

Well… I kind of got it working to a degree but don’t really understand the root of it.

I ended up just grabbing the whole json for the trello board and parsing it for the text that I ‘knew’ should be in the cards.

ie: the original card still ‘exists’, and they are the source of the original comments. Each time a new card is copied from that original, it links back to the original card.
In more simple terms, you have 3 cards,
the ‘first’ card has 3 comments
the ‘second’ card has those 3 comments and an additional comment
the ‘third’ card has those 4 original comments and 1 additional comment
So five comments total across the 3 cards.
The fact that they are named the same (or really named anything, doesn’t matter), Trello still thinks of them as single card it seems.

I did manage to scavenge the comment data though, by searching the board actions, and looking for cards like this: $boardResponse.actions |where-object {$_.type -eq “copyCommentCard”}
and using that to populate a $ with

“Comment” = ($boardResponse.actions |where-object {$.type -eq “copyCommentCard” -and $.data.card.id -eq “$cardID”}).data.text

I would also grab the commentCard data.text as well, and just smash them together.
of course, I’m now struggling with things like non-latin characters, and people who use trello in the most odd ways possible.

Long and short of it is that I can pretty much completely export all of a trello board to a csv file - and if I want push it to a.n.other product via api.

Special down thumb to having to figure out custom fields and values as well - that was horrible.