Created
April 19, 2019 23:36
-
-
Save iaindooley/dba84f2792fba2ee97dd8bbb2b916dc5 to your computer and use it in GitHub Desktop.
Search all boards and cards by custom field
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 searchAllBoardsAndCardsByCustomField(notification) | |
{ | |
var field = new Notification(notification).changedCustomField("Query"); | |
new Trellinator().boards().each(function(board) | |
{ | |
ExecutionQueue.push("findMatchingCustomFieldCards", | |
{card_id: field.card().id(),board_id: board.id(),field_value: field.value()}, | |
"findMatchingCustomFieldCards-from-searchAllBoardsAndCardsByCustomField-"+board.id(), | |
Trellinator.now()); | |
}); | |
} | |
function findMatchingCustomFieldCards(params) | |
{ | |
var card = new Card({id: params.card_id}); | |
var board = new Board({id: params.board_id}); | |
var field_value = params.field_value; | |
board.cards().each(function(card_loop) | |
{ | |
if(card_loop.id() != card.id()) | |
{ | |
board.customFields().each(function(field_loop) | |
{ | |
if((card_loop.customFieldValue(field_loop.name())) && | |
(card_loop.customFieldValue(field_loop.name()).indexOf(field_value) > -1) | |
) | |
{ | |
card.addChecklist("Results",function(list) | |
{ | |
list.addUniqueItem(card_loop.link()); | |
}); | |
} | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment