Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get current board Id in custom powerup

Hi

 

I have a power up that use the trello api to iterate a list's cards. But now I have to pass the board id, get the list by name and then iterate the cards.

 

I want to be able to do this without having to pass the boards id but instead do this on the current board where the power up is used.

 

Since it's an iframe I can't get the url from the trello board and compare to the url of the boards that I get in the api. How do I get current boards Id?

 

How can I create input boxes on my cards similar to CustomFields? 

 

Thanks

1 answer

@Anders  I built several custom power ups.  Once the user authorise his/account, the board id should be available to the JS that is associated with your power up. Because I do best with python, most of my business logic at the server side is via AJAX to some callbackurl that runs some py-Trello programs and my power ups are built on top of a Low-code platform. 

This custom power up iterate through a list and move cards a round .

Ok. And how do I retrieve that id?

@Anders not sure how to explain it better. 

See the partial code block below. This is for the card button to convert checklist to cards. The t.get('id') .then function(card) {....etc creates Card object from which the $(card.id) is obtained.

I do not need the board here but I think the board id variable would be $(card.board_id)

var cardSuperCLRun = function(t){

return t.get('member', 'private', 'token') .then(function(token) {
    if (!token) {
     console.log('No token found')
   }
return t.card('id') .then (function(card) {
  return t.popup({
    title: 'Superhero Checklist - Run',
    url: `/?action=run&card_id=${card.id}&token=${token}`,
    height: 200,
   });
 }) 

So once the card_id is passed to the callbackurl aka an endpoint. 

launch_card = client.get_card(󰀂v.107-card_id󰀂)

cardTrelloList = launch_card.trello_list

card_lookup = {}

for xcard in cardTrelloList.list_cards():
card_lookup[xcard.name] = xcard
card_lookup[xcard.url] = xcard
name_url = '''{} {}'''.format(xcard.name, xcard.url)
card_lookup[name_url] = xcard

trello_board = client.get_board(launch_card.board_id)

I can the board_id as should in the sample code above once I get the card object launch_card

Suggest an answer

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

📹 What is Trello?

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. I'll be sharing with you a series of videos with my top tips on how to best use Trello...

752 views 13 30
Read article

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