Created
March 16, 2021 14:07
-
-
Save iaindooley/20c9476c2b7ce503767fec617ac241bb to your computer and use it in GitHub Desktop.
createLinkedCardFromNewItem
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
var notif = new Notification(notification); | |
//when an item is added to checklist "Action Items" | |
var added = notif.addedChecklistItem(); | |
if(added.checklist().name() != "Action Items") | |
throw new InvalidActionException("Don't act unless added to Action Items"); | |
//convert the item to a linked card at the top of list "Inbox PlaceHolder" | |
var created = Card.create( | |
added.checklist().card().board().findOrCreateList(/Inbox Placeholder/i), | |
//using pattern "[{cardname} - {triggercardname}]({cardlink})" | |
//NB: it doesn't really make sense to use markdown formatting in a card name | |
added.name()+" - "+added.checklist().card().name()+" "+added.checklist().card().name() | |
); | |
added.setName(created.link()); | |
//NB: it doesn't make sense to add a link to the created card back to the triggercard | |
//and link the cards together | |
created.attachLink(added.checklist().card().link()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment