Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created March 16, 2021 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaindooley/20c9476c2b7ce503767fec617ac241bb to your computer and use it in GitHub Desktop.
Save iaindooley/20c9476c2b7ce503767fec617ac241bb to your computer and use it in GitHub Desktop.
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