Capabilities
Client Library
Color Theme Compliance (Beta)
UI Functions

t.attach(data)

With t.attach you can attach a URL to a card, as long as you are in the context of a particular card. A common use case for this is as the result of clicking a card-button.

1
2
var attachOnClick = function (t, opts) {
  return t.attach({
    name: 'The name for the attachment', // optional
    url: 'https://developer.atlassian.com/cloud/trello/' // required
  });
a

window.TrelloPowerUp.initialize({
  'card-buttons': function (t, opts) {
    return [{
      icon: './images/icon.svg',
      text: 'Attach a Thing',
      callback: attachOnClick
    }];
  }
});

Requires permissions.card === 'write'

You may want to check that t.memberCanWriteToModel('card') === true before even giving the user the option to attach something to a card.

Rate this page: