Copy a card and update dates by one week
Asked by Kerri Holiman:

We've just started using Trello to look at work load. In order to have a good long-term veiw, I need my recurring items to all show on the calendar (instead of just the next up). Before I manually copy and add dates to my weekly tasks for the rest of the year, is there a way to automate this so that I can copy cards and add 7 days to the start and end dates?


Answers:
author: milynnus
body: [@Kerri Holiman](/t5/user/viewprofilepage/user-id/4234567) [@Laura Templeton](/t5/user/viewprofilepage/user-id/4276240)

Have this endpoint that takes the due date and make it the start date of another card and you can bump that date +x or -x days.

This application was first inspired by [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) several months back and I have since migrated it.

<https://trello.com/c/z39XBKVX/30-start-date-from-due-date-with-bump-days>

The application is document on the board

<https://trello.com/b/POqPZOwG/just-a-butler-add-on>

Trying to understand what you are trying to achieve.


author: Iain Dooley
body: [@Kerri Holiman](/t5/user/viewprofilepage/user-id/4234567) this Trellinator function will do it:

<https://gist.github.com/iaindooley/00f60cf86f76d5ab5448ab91ad074425>

You just have to update the card link.

You can run it here on my BenkoBot platform, just choose "Ad Hoc" up the top after logging in:

<https://app.benkobot.com/>

comments: author: Laura Templeton
body: Hi [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112)

I work with Kerri and this project. I see you provided a platform to run the code, but I am not sure what the Trello API Key and API Token are to access the platform. Unfortunately we are not programmers so we need some super basic steps on how and where to implement the code you provided. Can you let us know what the next steps are?

Best,

Laura


author: Iain Dooley
body: [@Laura Templeton](/t5/user/viewprofilepage/user-id/4276240) Hey Laura, on the login screen, there's a link beneath each of fields. Just click it to get your API key (you just have to be logged into Trello as the account you wish to perform the actions). So you click the api key link, copy your api key back into the field, then click the token link and do the same.

Once you login, you will see "ad hoc" in the top right, you can click that then paste the code I provided in above, it will make 52 copies of the same card due 7 days apart.


author: Laura Templeton
body: Thanks, Iain!

Is there a way to copy an entire list of cards? We currently have 5 cards in the list we want repeated. I am thinking that it will take a lot of re-organizing to copy each card individually then merge back into 52 lists. I have attached a picture of how the end product needs to look.

Really appreciate all your help with this!

Best,

Laura


author: Laura Templeton
body: ![List.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/131852i07595A96B9EED842/image-size/large?v=v2&px=999 "List.PNG")


author: Laura Templeton
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) Forgot to tag you in the above comment yesterday


author: Iain Dooley
body: [@Kerri Holiman](/t5/user/viewprofilepage/user-id/4234567) [@Laura Templeton](/t5/user/viewprofilepage/user-id/4276240) okay I think this is what you're after:

<https://gist.github.com/iaindooley/8128c5431e2c2adb3a565ec0cc55f76e>


author: Laura Templeton
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) Thanks!

I replaced the Board Name (Prudential Weekly Tracker) and the List name (March 1 - March 5) in the code you provided, but I got an error message that the list was not defined. Do we need a line of code that links to the actual board/each card in the list?

Best,

Laura


author: Iain Dooley
body: [@Laura Templeton](/t5/user/viewprofilepage/user-id/4276240) hey sorry I had a typo in the code:

<https://gist.github.com/iaindooley/8128c5431e2c2adb3a565ec0cc55f76e>

note the change there I had "list.copy" instead of "template.copy"

Can you try again?


author: Laura Templeton
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) Thanks!

This time I got the following error message:

```
TypeError: (intermediate value).addDays(...).butlerDefaultdate is not a function
```

BUT! When I went to my board there was a duplicate of the board! I think if just run the code 48 more times I will have a weekly card for the rest of the year. Thanks again for your help!


author: Iain Dooley
body: [@Laura Templeton](/t5/user/viewprofilepage/user-id/4276240) gah! It's not much of a time saver if you have to run it manually 48 times and rename the lists!!!

I had another typo, the last butlerDefaultdate should have been butlerDefaultDate with a capital, sorry I was in a rush and didn't test, I've tested with a dummy board now and this works:

<https://gist.github.com/iaindooley/8128c5431e2c2adb3a565ec0cc55f76e>

Sorry again for the typos, I normally test code before I send it out to the community but I was rushing through. Haste makes waste!!


author: Laura Templeton
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) Thank you so much!