Using Butler to Create New Cards from a Checklist with Source-Card's Description (Or on dif board)
Asked by rax adaam:

Is it possible to (automatically) set any of the fields of a card created automatically by Butler from the checklist items of another card (e.g. customize the title of the new card with a prefix or suffix appended to the checklist item, or e.g. set the description of the new card, or e.g. have the new card created in a list on a different board)?

i.e. Card A has a checklist with three items:

* item 1
* item 2
* item 3

When certain conditions are met, I'd like butler to create three new cards titled:

* item 1 - suffix;
* item 2 - suffix;
* item 3 - suffix;

where the description of each of these new cards is a copy of the description of the source card.

Finally, I'd like the items in the original checklist to be replaced by links to these new cards.

----------------

I have tried countless work-arounds to achieve this, but have not found anything that works.

Ultimately, I just want to take the items of a checklist on a card and have them turned into separate cards in a list on another board, while still having direct access to the description, but every work-around I've thought of runs into a different Butler limitation (e.g. inability to append pre-/suffix to checklist item, inability to specify the board to which new cards created from a checklist are sent, inability to rename a checklist etc).

Our programmer writes up detailed updates with specific feedback points he's looking for. Up until now, our UI designer has provided feedback in the checklist, and tasks that need to be turned into new cards are coverted manually; however, the lack of formatting in checklists makes for rather dense \& unreadable cards. For the programmer, it is simplest to create a single card for each feedback cycle, whereas it is more efficient if the UX designer can provide feedback on each point individually (so that the programer needn't wait for all the feedback to be completed, in order to get started).

Been trying to sort this one out for close to 5H but am not getting anywhere. Can post attempted code, but I don't think they'd be helpful.

Thanks in advance for any insight, guidance, help or advice!

- RA


Answers:
author: rax adaam
body: I took another go at it this morning \& managed to get it to work, so thought I would share the steps here, in case anyone else wants to achieve the same thing. The principle issue was the ambiguity introduced by the semantic code when referring to "card" (i.e. when the rule creates a card for each checklist item, I ran into issues with when these loops finished; some re-arranging of the order of actions sorted it out).

---------------------------------

**There are two parts to this post**:

* **A - what the rule does**, along with brief commentary on the pain-points encountered when trying to implement it (pain points are included as bullets below each step of the process, so if you just want to know what the script does, ignore the bullets).
* **B - two versions of the final, functional rules**.

---------------------------------

**Part A - What the Rule Does**

This script takes a card with certain triggers (in this case the card title must a) contain a specific string; b) be assigned to me; c) contain a checklist with a specific name, and d) be added to a particular list -- because the desired trigger will vary for other users, I won't include it here) and

1. creates a linked card for every item in the checklist, copying labels and members.

* one issue I ran into, originally was how to modify the checklist items' names: I wanted to append a suffix that would be included in the title of the newly created linked-card. In the first place, I just didn't consider that I could add the suffix directly to the link name (i.e. I was using \`\[{cardname}\]({cardlink})\` and just didn't think of using \`\[{cardname} - suffix\]({cardlink})\` or \`\[{cardname}\]({cardlink}) - suffix\`.
* Although the above renamed the checklist items, it did not apply this name to the newly created linked-cards (i.e. the linked cards did not have the suffix, and I wanted the suffix in order to trigger a later part of the rule; one that would sort those cards to another list on another board). I figured out how to address that using another loop, later in the rule (see below).

2. moves the original (i.e. trigger) card to the top of another list.

* This is one of the issues I ran into with the loops: originally, this was the last action in the rule; however, as a result, it applied it to all the newly created cards, because there was no clear way of terminating the cascade loop. Moving the action up in the rule resolved the issue.

3. sets the description of the newly created linked cards to the original (i.e. trigger) card's description (this ensures that contextual information is available in each card, without having to navigate back to the original card).

4. appends a suffix to the newly created linked cards.

* the pre-/suffix was only used in order to trigger another rule that would move those newly created cards to another list on another board (as the cascade option only allows one to specify a list on the current board); however, that ultimately turned out to be unnecessary, as the cascade action "for each card linked from an incomplete item in checklist" can be combined with "move the card" in order to achieve the same result, using a single rule (this streamlined variation is the 2nd version of the code, below; I included both as I spent a long time just trying to figure out how to set the name of cards created by the cascade option "create linked card for each checklist item."

5. Moves the newly created linked cards to a list on another board.

* In version 1, below, this is achieved using a separate rule that is triggered by the suffix appended to the newly created cards; in version 2, it is achieved using a single rule and without modifying the card names.

**-----------------------------------------------------**

**Part B - The Rules**

* **Version 1 (two rules - rule 1 adds a suffix to cards that triggers rule 2):**
  * Rule 1:  

    ```
    when a card with a name containing "- Feedback Round" assigned to me with checklist "? Feedback points" incomplete is added to list "Templates Copy", convert all the items in checklist "? Feedback points" into linked cards in list "Templates Copy" using pattern "[{cardname} - UI Feedback]({cardlink})" copying labels and members, move the card to the top of list "To-Do", for each card linked from an incomplete item in checklist "? Feedback points", set the card's description to "{triggercarddescription}", and rename the card to "{cardname} - UI Task"
    ```

  * Rule 2:  

    ```
    when the name of a card ends with "- UI Task", move the card to the top of list "Inbox" on board "UI Feedback"
    ```

    N.B. for these rules to interact properly, the appending of the suffix that triggers Rule 2 had to be the last action of Rule 1, otherwise the rules were triggered at the same time, and multiple copies of each card were created (I assumed that rules would not run in parallel, and that one rule would complete running prior to another rule being triggered; but this does not appear to be the case).

* **Version 2 (single rule, assigns newly created cards to a list on a different board by using a cascade action, instead of a suffix trigger):**

  ```
  when a card with a name containing "- Feedback Round" assigned to me with checklist "? Feedback points" incomplete is added to list "Templates", convert all the items in checklist "? Feedback points" into linked cards in list "Templates" using pattern "[{cardname} - UI Feedback]({cardlink})" copying labels and members, move the card to the top of list "To-Do", for each card linked from an incomplete item in checklist "? Feedback points", set the card's description to "{triggercarddescription}", and move the card to the top of the list "Inbox" on the board "UI Feedback" 
  ```

This is really cool, as it allows our programmer to create a single card for each UI Feedback cycle, include relevant information (which bugs have been addressed; new features implemented etc) and to simply list the specific points he wants feedback on as separate items in the checklist, but then each of the feedback point is transformed into a separate card (containing all the general update info) on a separate UI Feedback board (so it doesn't clutter the group board), where I can respond to each feedback point, one at a time. \[Once complete, I move the task to a "completed" list that then sends the card back to the group board, checks off the corresponding to-do item in the original card, and assigns it to the programmer (which allows him to start working on each feedback point, as it is completed, instead of waiting for the whole cycle to be finished).\]

Hope this might be helpful to someone else trying to achieve any of these individual steps. If you want to achieve something similar, or any individual step and have a question, feel free to reach out \& I'll try to help, if I can :)

All the best,

- Rax A.

<br />

comments: author: MF_BOT
body: [@rax adaam](/t5/user/viewprofilepage/user-id/4076099) Did you try to add the triggercard attachment? I'm trying to figure out how to do this and have yet to find a way.


author: milynnus
body: [@MF_BOT](/t5/user/viewprofilepage/user-id/4275049)

I do have an api developed for this. Unfortunately, while the FastAPI app is working, I am not able to show you the documentation in Swagger UI. The hosting provider had not been able to give me the cause or help resolved it. This from the code

```
class Payload(BaseModel):
card_id: str
alt_card_id : str
option : Union[str, None] = ""


@router.post("/copy_attachment")
async def copy_attachments (
request : Request,
payload : Payload
):
```


author: milynnus
body: [@rax adaam](/t5/user/viewprofilepage/user-id/4076099)

Go the swagger ui up :

<https://superbutler1-fkiongaq.b4a.run/docs#/Attachment/copy_attachments_attachment_copy_attachment_post>


author: Iain Dooley
body: [@rax adaam](/t5/user/viewprofilepage/user-id/4076099) it sounds like you could just create linked checklist items and get the result you're looking for using the "convert checklist into linked items" command:

<https://community.atlassian.com/t5/Trello-articles/Trello-Subtasks-with-Butler/ba-p/1060392>

What am I missing?

comments: author: rax adaam
body: [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) -- thanks for the reply. I actually sorted it out and wrote up a full post explaining the solution, but we lost power for 2 days, so am only able to reply now. I'll post it, presently.

The issue I had was that I needed the automatically created cards to have some unique element that would cause them to be processed, as desired \& I couldn't figure out how the semantic for-loops worked.

Thanks for taking the time to reply \& share the link. Really appreciate the help. If you have any suggestions on a better implementation of the code I came up with, I'd be very interested to learn to improve.

All the best,

RA


author: milynnus
body: [@rax adaam](/t5/user/viewprofilepage/user-id/4076099) You can take a look at my Superhero Checklist. It is based on a custom Power Up with I built onto of a low-code platform. There are 3 options for the checklist item after it is converted to a card, namely (1) leave it "as is" aka name only (2) change it to a URL (3) change it to a name + url

Above suggest that you can tailor the checklist item the way you want it or for that matter the card name. Just have to be aware that some choices can limit your ability to track back if you want to say, mark checklist item as completed.

<https://youtu.be/TE1jPfkwako>

FYI a new function added after video product include the ability to create cards, leave it list, work on them, then mass transfer them to another list.

comments: author: rax adaam
body: [@milynnus](/t5/user/viewprofilepage/user-id/3947182) - Thank you again for such a quick response. I will check this out for sure.

Where can I learn more about coding for Trello in this way? I didn't realize this was an option and, based on the limitations of Butler that I've encountered so far, I'm thinking it might be more efficient for me to look into coding solutions, myself.

I'll be sure to update here if this solve the issue. Thank you very much for taking the time time to help and share your knowledge!

All the best,

-RA


author: milynnus
body: [@rax adaam](/t5/user/viewprofilepage/user-id/4076099) It is a custom Power Up coding but deployed on Wayscript. Wayscript has Trello modules and triggers and other modules like HTTP Triggers, Timers...etc. I also used py-Trello libraries to build the core processes. The Power Up development would invoke some JavaScript and HTML.   

The above is also used to built "as a service" Butler Add on using its HTTP Request to run pre-tested modules. It also can be delivered via Trello webhooks and it supports Code by Zapier as part Zapier-Trello interface. It's registry, code and sandbox are all on Trello boards.


author: milynnus
body: Here's an checklist module that can be delivered as a Butler Add on. Not difficult to enhance it to do what you wanted.

![D81FDD71-D273-4B3A-ADA6-C8E72A7C6396.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/109349iF873E9D19C976035/image-size/large?v=v2&px=999 "D81FDD71-D273-4B3A-ADA6-C8E72A7C6396.jpeg")