Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,466
Community Members
 
Community Events
165
Community Groups

How to copy custom field value (checkbox) to a linked card with butler?

Hi all,

 

At this moment, when I add an item to a checklist, it finds the {checklistitemname} on the board and links the card together.

 

The checklistitemname card has a customfield "Bio" checked or unchecked standard.

When the checklistitemname card is linked to the triggercard, I want it to copy the customfield value of "Bio".

 

Use-case:

 

I have a card "TRIGGER" and a card "ITEM".

ITEM has a custom field "Bio" checked.

TRIGGER has a custom field "Bio" unchecked (standard) and has a checklist. To this checklist, ITEM is added. TRIGGER and ITEM are now added to the Trello attachments and linked to each other.

Now, because ITEM has "Bio" checked, I also want TRIGGER to check the custom field "Bio".

 

Is this possible?

Thanks in advance!

1 answer

1 accepted

1 vote
Answer accepted

@J. vd W. 

I think you are the same person that posted it Reddit. I am going to build a specific end point that handles this use case.

lookup a card titled "ITEM" in list "Lookup", and post to url "https://jviwoq.deta.dev/update_checkbox?api_key=14a...............21d7&token=be9f...................a6cb4" with payload "{"card_id" : "{triggercardidlong}", "alt_card_id" : "{foundcardidlong}", "cf_name" : "CF_Checkbox"}"

The endpoing with redoc :

https://jviwoq.deta.dev/redoc#operation/update_checkbox_update_checkbox_post

The documentation on github :

https://github.com/xu2xulim/Superhero/blob/master/Superhero%20on%20deta/Micros/Custom%20Fields.md#update_checkbox

 

Hi Milynnus,

 

Thanks for the effort!

 

This is the rule I'm using:

when an item starting with "{checklistitemname}" is added to a checklist, lookup a card titled "{checklistitemname}", and post to url "https://jviwoq.deta.dev/update_checkbox?api_key=14a...............21d7&token=be9f...................a6cb4" with payload "{\"card_id\" : \"{triggercardidlong}\", \"alt_card_id\" : \"{foundcardidlong}\", \"Bio\" : \"Bio_Checkbox\"}

The {checklistitemname} card has Custom field "Bio" checked.
When I add {checklistitemname} to card "TRIGGER" it doesn't check the "Bio" checkbox on card TRIGGER.

It gives the following error in my butler warning box:

 

There was an error requesting the URL https://jviwoq.deta.dev/update_checkbox?api_key=14a...............21d7&token=be9f...................a6cb4:

422 {"detail":[{"loc":["body","cf_name"],"msg":"field required","type":"value_error.missing"}]}

 

Any ideas?

Thanks in advance.

@J. vd W. 

Couple of observations :

  1. Looking at the log you were trying to use GET instead of POST
  2. you have to use your own api key and token
  3. You should use "cf_name" : "Bio_Checkbox" as part of payload 

I have update my code to support the case where the alt_card (target) and the corresponding CF is not on the same board.

Thanks for trying.

Like J. vd W. likes this

Hi @milynnus ,

 

1. I'm unsure what that means. I've definitely used the "POST to ..." option in the automation butler.

2. Woops, I've done that now.

3. I've changed the code, I hope it's okay now:

 

when an item starting with "{checklistitemname}" is added to a checklist, lookup a card titled "{checklistitemname}", and post to url "https://jviwoq.deta.dev/update_checkbox?api_key=a20xxxxxxxxxxxxxxxxxxxxxxx225fc&token=21fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2b" with payload "{\"card_id\" : \"{triggercardidlong}\", \"alt_card_id\" : \"{foundcardidlong}\", \"cf_name\" : \"Bio_Checkbox\"}"

 

Is this how it should be? It's currently still not ticking the checkbox, giving me this error:

"400 {"result":"The custom field(s) is not a checkbox or custom field not found"} "

 

So I changed the code to:

 

when an item starting with "{checklistitemname}" is added to a checklist, lookup a card titled "{checklistitemname}", and post to url "https://jviwoq.deta.dev/update_checkbox?api_key=a20xxxxxxxxxxxxxxxxxxxxxxx225fc&token=21fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2b" with payload "{\"card_id\" : \"{triggercardidlong}\", \"alt_card_id\" : \"{foundcardidlong}\", \"cf_name\" : \"Bio\"}"

This gives the result:

"result":"OK"}

 

But it still doesn't tick the box.

 

Any ideas?

@J. vd W. 

Congrats 🎉 you have got further. 
The first error is when you supplied a cf that is not of type = checkbox or there is no checkbox CF matching the name.

 
The end point takes the checkbox status from the first card and update the cf of the second (alt_card_id). Since I cannot see your board, I can be definitive. 

Like J. vd W. likes this

Hi @milynnus ,

Thanks haha! With your help ofcourse.

I'll try to explain it a little more in-depth, so I've made a test case:

pic1.png

I have two cards, as shown above: Trigger and Item.

 

"Item" is a one-time input, this is the product. It's either bio or not, so this is checked only once and that's permanent.

"Trigger" is the customer order, so each time a customer places an order, the employee creates a new card.

 

Then, the product (Item) gets linked to the customer order (Trigger), this is done by adding "Item" to a checklist in card "Trigger". It links the cards.

The moment "Item" is added to a checklist in card "Trigger", I want it to check if "Item" has custom field "Bio" checked, yes/no. And I want it to copy this value to "Trigger".

 

Any other suggestions? I think perhaps the triggercardidlong/foundcardidlong aren't correct, though I'm unsure because I truly have no experience in this.

@J. vd W. 

if I understand you correctly, 

your card_id will be {foundcardidlong} and your alt_card_id is {triggercardidlong}. 

@milynnus 

Yep, that's it! Thank you so much. :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Trello

Taco Tuesday: New years' resolutions with Trello

Congratulations to @Laura Holton , our latest winner of Taco Tuesday! And thanks to @Kristján Geir Mathiesen for sharing the picture of Taco having fun with his new friend  B...

2,361 views 28 40
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you