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

Getting shared power-up data from another user Edited

Referencing: Getting and Setting Data

When I store data in the member scope with visibility shared, how am I supposed to retrieve this data from the t object when I'm logged in as another user?

 

Example

Logged in as user1: I store something via

t.set('member', 'shared', key, value)

Then, logged in as user2 (admin on the board): I want to retrieve the value stored for user1. Since I've set visibility to shared, I expect this to be possible. The docs also state:

A visibility of shared means that any Trello member who can see the object it is stored against (determined by Scope) can see the data.

However, I can only get my own data using

t.get('member', 'shared', key, defaultValue)

 

Is there something I'm missing here? I've also tried to pass a user id instead of 'member', but this gives me an error: "Card not found or not on current board (Command: data)" since it treats the first value as a card id.

 

Any help appreciated,
Thank you ;)

3 answers

1 accepted

1 vote
Answer accepted

In general i've found it best to use the rest api for interacting with trello data, even within the powerups. That said, I haven't seen a good way route for interacting with a different user's plugin data either.  The board approach isn't a bad idea as long as your user count isn't too high.  There's always the option of creating a small data set wherever you are hosting your powerup to store lightweight user data.  

Yeah, true, we can always store something on the server hosting the plugin, haven't thought of it ;)

I'll go with the board approach for now, storing keys on the board in the form

"<attributeName>-<userId>": <value>

At least, I can now update all the keys for every member using t.set(...) and the board scope.

Would be great to see the Trello REST API support PUT, POST and DELETE methods for managing pluginData. Why would t.set(...) (where you can actually update key-value pairs) be more powerful than the REST API itself?

Don't forget that you can also store at the organization level to if it's global data you want to store in other boards.  I use that to capture info about my users and overall setting that I want to extend across all boards using my powerup within a particular team.

Thanks, that's a great option, will definitely try this out.

As a workaround, I've stored the data in the board scope with individual keys that have the user id appended, like:

const key = `myKey-${userId}`
t.set('board', 'shared', key, value)

and retrieve it the other way round.

But this is not optimal, since - logically - I'd say that something I want to store for a member should beloing to this member's scope.

 

I could also fetch the Trello REST API using the endpoint

/members/:id/pluginData

but the problem is, as the docs state

Currently, PUT, POST, and DELETE methods are not supported for managing pluginData.

So, I couldn't update or delete a key from another user (key-scope member with visibility shared) using this approach.

Suggest an answer

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

📹 Favorite Trello templates

Hello Community!  My name is Brittany Joiner and I am a Trello enthusiast and Atlassian Community Leader. In this video, I'll share my favorite Trello templates. Templates mentioned in ...

75 views 4 5
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