Finding or looking up cards (Butler advanced topic)

Finding cards

When you run a Butler command by selecting a Card Button or by triggering a Rule that reacts to changes on a card, the actions of the command (like adding a label or posting a comment) happen on the card where the trigger happened. This card is called the trigger card. 

If you need your Butler command to make changes on other cards or obtain information from them, you can use the find and lookup actions. These actions are available in Rules, Card Buttons, and Due Date commands on the Cascade tab.

Example 1

The following Rule links any cards emailed to the board with the card that has the same name (if this card exists on the board). In this command, the card emailed to the board is the trigger card. 

when a card is emailed into the board, find a card titled "{cardname}", and link the cards together


Example 2

In the following command, a card has another card linked in the attachments. When the first card is moved to the list "Done", it initiates the movement of the linked card to the same list, provoking a cascading effect. The card moved to the list "Done" is the trigger card.

when a card is moved to list "Done", find the first card linked in the attachments, and move the card to list "Done"

However, when you find another card, that card becomes the current card, and all actions going forward will occur on that card. In this case, if you use card variables in your command (such as {cardname}, {carddescription}, or {cardduedate}), they will refer to the found card, since it's the current card.

To refer to the content of the trigger card, you need to use card variables with the trigger prefix like {triggercardname}, {triggercarddescription}, or {triggercardduedate}. For example, each time you add a card to a list, you can also add a link to the trigger card as an item in a checklist in another card:

when a card is added to list "Doing" by me, find a card titled "Rollup", and add item "{triggercardlink}" to checklist "Doing"

Looking up cards

Note: Don't use lookup actions as a generic database-style functionality in Trello. Creating lookup tables with thousands of cards will result in poor performance.

If you want to find another card but continue working on the current card, you can use the  lookup action. It's used exactly like the find action, but it doesn't change the current card. 

You can refer to the found card by using card variables with the  found prefix. For example, {foundcardname}, {foundcarddescription}, and {foundcardduedate}.

Example 1

Imagine you want to set a custom field named "Priority" according to the value of two other custom fields: "Scope" and "Impact". When "Scope" is Small and "Impact" is High, you should set "Priority" to P1, but when "Scope" is Small and "Impact" is Low, the "Priority" filed should have the value of P3

This would require a large number of rules, but with a lookup action, you can create a card for each combination:

  1. Create a list named "Priority lookup". 
  2. Add a card named "Small, High" with the description "P1". 
  3. Add a card named "Small, Low" with the description "P3". 

Create two Butler rules to perform automated lookups:

  • when custom field "Scope" is set by anyone, lookup a card titled "{{%Scope}}, {{%Impact}}" in list "Priority lookup", and set custom field "Priority" to "{foundcarddescription}"
  • when custom field "Impact" is set by anyone, lookup a card titled "{{%Scope}}, {{%Impact}}" in list "Priority lookup", and set custom field "Priority" to "{foundcarddescription}"

When any of the board's users sets the "Scope" and "Impact" custom fields, Butler will automatically set the "Priority" custom field. 

Example 2

You might perform card lookups to calculate some data. For instance, you can calculate the final price of the product for each state by setting the "Final Price" custom field according to the value of other custom fields: "State", "Tax", and "Item Cost".

You can create cards for different combinations:

  1. Create a list named "Costs". 
  2. Add a card named "Texas" with the description of a tax percentage as a decimal. For example, 0.062 (6.2%). 

Create two Butler rules to do the calculation:

  • when custom field "State" is set by anyone, lookup a card titled {customfieldvalue} in list "Costs", and set custom field "Tax" to "{foundcarddescription}"
  • when custom field "Item Cost" is set by anyone, set custom field "Final Price" to "({{%Tax}} * {{%Item Cost}}) + {{%Item Cost}}"

Note: The preceding rule includes the custom field arithmetic to do the calculation. You can perform basic arithmetic operations such as addition, subtraction, multiplication, and division when setting the "Numbercustom field.

When any of the board's users sets the "State" to "Texas" and enters the product price in the "Item Price" custom field, Butler will automatically set the "Final Price" custom field.