Skip to content

Instantly share code, notes, and snippets.

@iaindooley
iaindooley / gist:6be5d093f1c06018123506ce4e8a12bd
Last active September 27, 2021 05:55
createCardWithChecklistAndItems
console.log(
Card.create(
new Trellinator().boards().first().lists().first(),
"Hi there"
)
.addChecklist("My Checklist",function(cl)
{
cl.addItem("one");
cl.addItem("two");
cl.addItem("three");
@iaindooley
iaindooley / gist:fc2dcee1feb30f6fbb2934f4d2aa93b3
Created September 25, 2021 04:22
setCustomFieldToNextChecklistItem
var checked = new Notification(notification).completedChecklistItem();
var next = checked.checklist().itemAfter(checked);
checked.checklist().card().setCustomFieldValue("Next Action",next.name());
new Notification(notification).addedLabel("Remove All Attachments").card().attachments().each(function(att)
{
att.remove();
});
@iaindooley
iaindooley / gist:f40f9fb431fc1109e1615dcf4e2fdadf
Created September 24, 2021 05:52
updateChecklistItemDatesBasedOnDueDate
var card = new Notification(notification).addedDueDate();
copied.checklists().first().items().each(function(item)
{
var diff = item.due().getTime() - card.previouslyDue().getTime();
item.setDue(new Date(card.due()).addSeconds(diff));
});
@iaindooley
iaindooley / gist:b70d94d908eabfc93e8ec6bc5c529fa0
Created September 24, 2021 05:19
addMemberFromEnvironment
//When a card is moved to the Doing list
var moved = new Notification(notification).movedCard(/Doing.*/i);
moved.addMember(new Member({username: ___persistence.get("Support Co-ordinator")}));
@iaindooley
iaindooley / gist:79e9b584f91846d442a4d9ad6f2018c2
Created September 24, 2021 05:15
prependNameAndAssignLabel
var created = new Notification(notification).this.convertedChecklistItemToCard();
created.setName(
created.source.card().name()+" "+created.name()
);
create.source.card().labels().each(function(label)
{
created.addLabel(label.name());
});
var arched = new Notification(notification).archivedCard();
if(arched.currentList().name() == "Doing")
arched.board().list("My Tasks").cards().random().moveTo("Doing","top");
new Trellinator().board("My Tasks").list("To Do").cards().random().moveTo("Doing","top");
___queue.put(
"randomlySelectTasks",//the action to run
{},//optional parameters passed into the next execution
Trellinator.now().addDays(1).at("7:00")//the time to run next
);
var search = "Triad";//change this when you run it
new Trellinator().board("My Board").cards().each(function(card)
{
if(card.description().toLowerCase().indexOf(search.toLowerCase()) > -1)
{
card.addLabel(search);
}
});
var moved = new Notification(notification);
moved.copyToList(new Trellinator().board("Client Board").list("Inbox"),"top")
.attachLink(moved.link());