How to copy all comments from one Trello card to another during card creation
I have a zap running, where if a card hits a certain list on board A, it creates a new card on Board B with all custom fields required.
What I can’t figure out is how to add all comments made on Card A to the newly created card on Board B. I can see options to add one comment at a time, however not all cards have the same amount of comments and I want to add all comments to the new card.
How would I do this?
Page 1 / 1
Hey there @KimV84!
You could try using a Looping action for this. Looping would allow you to run a Create Comment Trello action multiple times, one for each of the comments on Card A. You can learn more about how to use it here: Loop your Zap actions.
Give that a try and let me know if you if you run into any issues?
Hi,
This has worked like a charm! Thank you so much for your help!
Yay! That’s amazing news, @KimV84!
I’m so glad that did the trick. Let me know if there’s anything else I can help with. In the meantime, happy Zapping!
I believe I may have cheered too soon unfortunately, the comment section is now being added to the the card multiple times (as many times as the loop iteration has data for) so I believe I haven’t set it up quite right. Would the issue be the flow of the zap?
The first step is to create the card, the next is the loop and then create comment, I wonder if this is the right order?
I may have cheered too early When the zap runs, it only adds a comment for the last comment that was made on the old card to the new card. I’ve obviously not set this up correctly, but I’m unsure why it’s not running the loop as expected
So sorry to hear that, @KimV84!
Can you share some screenshots of the setup of the Zap? I’d like to check the Configure section for all the actions in particular to get a better idea of what might be causing the issue here. Make sure to blur or remove all personal information (names, emails, addresses etc.) from screenshots before sharing - you can use a tool like Zappy for that.
Looking forward to your reply, keen to get to the bottom of this!
Hi,
Here’s a screenshot of the full Zap:
Thanks for sending that over, @KimV84. From the overview, it’s a bit tricky to see the selected fields and settings.
Can you please share additional screenshots showing the Configure section of both the Create Loop from Text and Create Comment actions so I can see exactly how they’re set up currently?
For example:
Appreciate it!
So sorry, I understood your advice wrong! This is from the Create Loop step:
And this is from the create comment step:
No worries, @KimV84! Thank you for sharing those additional screenshots. You set up looks correct so I did some testing on my end and it appears that Trello supplies the comments in reverse order:
Which is why the first loop contains the last comment, as the last comment appears first in the list of comments. When testing action in a loop only the first loop will be run, but when the Zap is switched on all loops will be run.
If you want the comments to be added in the same order as they were added to the original card then you could try using a Code action to reverse the order of the comments. For example, this Javascript code:
// Reverse the order of the comments const reversedComments = comments.reverse().join(',');
// Prepare the output with the reversed comments output = { reversed_comments: reversedComments };
Would output the list of comments in reverse order:
You’d then map that reversed list of comments to the Looping action instead of selecting it directly from the trigger, like so:
Can you give that a try and let me know if that fixes it?
The order of the comments isn’t really the issue, it’s the fact that it only copies over 1 comment when there are multiple comments on the card it’s copying from, even when the zap is live.
Thanks for getting back to me, @KimV84. That’s really strange.
Can you share some screenshots of a recent example of this from the Zap history for each of the comments that should have been added to the same card? Please note: each loop run will appear as a separate Zap run in the Zap history.
That will help us to see the comments that were sent from the trigger as well as what comments the Looping action passed to the Trello action to be added as a new comment. Looking forward to hearing from you on this!
Hi, apologies for getting back on this so late, I had been off work for a while and only now picking this back up!
Data In to Loop action:
Data out from Loop action:
Data in to Trello Add Comment action: (I would expect to be able to select the split out comments on this step, but I’m unable to)
And this then results into just having everything on the card as 1 long comment, which is not ideal.
Please let me know if this is what you needed!
No worries, @KimV84. Sorry for the delay on my side too, I’ve also been away!
Hmm, it looks as though the loop is correctly creating loops for each comment but the Create Comment action is receiving a list of all the comments not a single comment. Has anything changed to the field that’s been selected on the Create Comment action within the loop? Previously it looks as though the Comments field was selected and only the first comment should have been supplied:
So it’s very odd that it’s adding all the comments. I wonder if there issue could be related to the Trello trigger supplying the comments as line items instead of a comma separated list (which is how it would appear in the Card Comments Data Text field). It could be that it handles the line items differently when the Zap runs live
Can you try changing the Looping action to use the Create Loop From Line Items event instead:
Then reselect the Card Comments Data Text field in the Values to Loop to create the loops:
Then retest the Looping action to create the loops. The Comments field that it outputs should only contain the comment from the first loop:
Then in the Create Comment action reselect the Comments field from the Looping action:
Then retest the Create Comment action to check that only the comment from the first loop was added, not all the comments:
Hopefully that’ll help to sort it Keep me posted on how it goes!
Hi, I tried this and now it only adds 1 comment instead of all unfortunately
Hi @KimV84!
That’s how it should be when testing in the Zap Editor, but when the Zap is switched on, it should loop through each of the comments and add them. Each loop will appear in the Zap history as a separate Zap run though.
Can you try switching the Zap on and do a live test to check that all the comments get copied across as expected?
Hi, sorry I should have mentioned this, but I did test it on live and the created card only had 1 comment on it. I did double check and the original card it should have looped, had several comments on it.
Ah, I see! Thanks for clarifying that, @KimV84.
In that case can you send over some screenshots of the Data In and Data Out of the Create Loop from Line Items and Create Comment actions for the recent Zap run that only created one comment? This should help us to better determine why it didn’t create the other comments. Appreciate your help with this!
Hi Sam,
So it didn’t work on the first card it pulled through, but it now seems to have worked for the last couple of cards it has pulled through to the new board. Thank you so much for your help (and patience!)
You are most welcome, @KimV84 Really pleased it’s working now!
Do keep an eye on things though, and if you run into any further issues just let us know—always happy to help!