Created
November 3, 2019 01:51
-
-
Save iaindooley/d1a78472a217706a9023d38af502ef1e to your computer and use it in GitHub Desktop.
Copy and link cards preserving checklist state
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 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