Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created February 27, 2019 23:24
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/60b72145142387b7f875ec1fe99a956e to your computer and use it in GitHub Desktop.
Save iaindooley/60b72145142387b7f875ec1fe99a956e to your computer and use it in GitHub Desktop.
Trello Subtasks
function subtasks(notification)
{
var notif = new Notification(notification);
//If a new checklist item was added
var item = notif.addedChecklistItem();
//If this was not added by Trellinator, and it was added to a checklist
//called "Subtasks"
if(notif.member().notTrellinator() && (item.checklist().name() == "Subtasks"))
{
//Set the text of the item ...
item
.setName(Card
//... to a link to a newly created card ...
.create(notif
.board()
//... in a new or existing list with the name of the trigger card
//plus the text "Subtasks"
.findOrCreateList(notif
.card()
.name()+" Subtasks",
//... in the next position from the trigger card list ...
parseInt(notif.card().currentList().position()+1)),
//... named after the created checklist item ...
item.name())
//... then attach a link to the trigger card, onto the created card ...
.attachLink(item
.checklist()
.card()
.link())
.link());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment