Created
February 27, 2019 23:24
-
-
Save iaindooley/60b72145142387b7f875ec1fe99a956e to your computer and use it in GitHub Desktop.
Trello Subtasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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