Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
createLinkedCardFromNewItem
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