Skip to content

Instantly share code, notes, and snippets.

@iaindooley
Created November 3, 2019 01:51
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/d1a78472a217706a9023d38af502ef1e to your computer and use it in GitHub Desktop.
Save iaindooley/d1a78472a217706a9023d38af502ef1e to your computer and use it in GitHub Desktop.
Copy and link cards preserving checklist state
function copyAndLinkCardsPreservingChecklistState(notification)
{
var added = new Notification(notification).addedCard("A");
var copy = added.copyToList(
Board.findOrCreate("B").findOrCreateList("A faire"),
"top"
);
added
.attachLink(
copy
.attachLink(added.link())
.link()
);
added.checklists().each(function(cl)
{
cl.items().each(function(item)
{
if(item.isComplete())
{
copy.checklist(cl.name()).item(item.name()).markComplete();
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment