Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created February 21, 2019 06:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/54eed49157d54ca8452d59f678f7a384 to your computer and use it in GitHub Desktop.
Save iaindooley/54eed49157d54ca8452d59f678f7a384 to your computer and use it in GitHub Desktop.
Delete cards older than 1 year
//schedule this function to run tomorrow at 3am using a time trigger
//in your Trellinator configuration sheet. It will then
//execute daily
function deleteOlderThanOneYear(board,signature,original_time)
{
new Board(board).list("Completed").cards().each(function(card)
{
if(card.movedToList() < Trellinator.now().minusDays(365))
{
card.archive();
}
});
ExecutionQueue.push("deleteOlderThanOneYear",board,signature,original_time.addDays(1));
}
//schedule this function to at midnight this Sunday using
//a time trigger in your Trellinator configuration sheet. It will
//then execute weekly
function deleteArchivedCards(board)
{
TrelloApi.searchCardsInBoards(new Board(board),"is:archived").each(function(card)
{
card.del()
});
ExecutionQueue.push("deleteArchivedCards",board,signature,original_time.addDays(7));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment