Class: Board

TrelloEntities.Board(data)

The Board class represents a Board in Trello. Every Notification will have a board object associated with it because all Trellinator webhooks are registered at the board level. When a Time Trigger function is added, the parameters passed into the function are simply a board id that can be passed directly into the constructor for Board.

If you need to access another board, use the Trellinator class to load it.

Constructor

new Board(data)

Parameters:
Name Type Description
data

(Object} key/value pairs of information, must at least contain "id", can basically just pass in response from Trello API

Source:
Examples
//a Notification driven function
function doSomething(notification)
{
    new Notification(notification)
    .replyToMember("You are on: "+
    new Notification(notification).board().name());
}
//get access to another board via Trellinator
new Trellinator().board("Some Board");
//a function executed from a Time Trigger
//on a recurring basis
function recurringFunction(params,signature,original_time)
{
    new Board(params).card("Search").postComment("It's that time again!");
    ExecutionQueue.push("recurringFunction",
                        params,
                        signature,
                        original_time.addDays(7).at("9:00"));
}

Methods

(static) Board.create(data)

Create a new board from an object containing key/value pairs. The minimum required is "name", with other options available at https://developers.trello.com/reference/#boardsid

If you are creating a new board from a template, you might prefer to use the Board.copy() method instead

Parameters:
Name Type Description
data Object

an object containing key/value pairs for all the fields

Source:
Example
Board.create({name: "Hi there!"});

(static) Board.findOrCreate(data, global_command_group)

Find a board by name if it already exists, or create one if it doesn't. The data you pass in can either be a string, or an array of key/value pairs at least containing a name. If a board with the name already exists it will be returned, otherwise a board will be created using all the data you provide

Parameters:
Name Type Description
data string | Object

either a board name or an object of key/value pairs at least containing name

global_command_group string

(optional) a global command group to add the board to if a new one is created

Source:
Examples
Card.create(Board.findOrCreate("New Board").findOrCreateList("ToDo"),{name: "Hi there!"});
Board.findOrCreate({name: "Hi there!",idOrganization: new Trellinator().team("Some Team").id()});

(static) this.addMember(member, type)

Add a Trello member to a board

Parameters:
Name Type Description
member Member

a Member object to add to this board

type string

admin or normal, defaults to admin

Source:
Example
new Trellinator().board("Some Board").addMember(new Notification(posted).member());

(static) this.archive()

Archive this board

Source:
Example
new Notification(posted).board().del();

(static) this.card(name)

Get a single card from the board matched by name or regex

Parameters:
Name Type Description
name string | RegExp

the name or regex to match if more than one card matches, will just reeturn the first

Source:
Example
new Notification(posted).board().card(new RegExp("Finders.*")).postComment("Keepers");

(static) this.cards(name)

Get an IterableCollection of Card objects on this board optionally filtered by name (or by regex)

Parameters:
Name Type Description
name string | RegExp

a string or RegExp to restrict the cards returned

Source:
Example
new Notification(posted).board().id();

(static) this.copy(name, team, permission, no_members)

Create a new board by copying this one into a team, preserving members

Parameters:
Name Type Description
name string

the name for the new board

team Team

optional - a Team object to add this board to. All boards must now be members of a team in Trello, so if this is not provided default to new Trellinator().teams().first().id()

permission string

optional - org, private, public (defaults to "org")

no_members string

optional - true if you don't want to invite members from the template board

Source:
Example
var trellinator = new Trellinator();
trellinator.board("My Template").copy("My Project",trellinator.team("Some Team"));

(static) this.createList(name, pos)

Create a list even if a list with the same name already exists

Parameters:
Name Type Description
name string

the name of the list to find, creating it if it doesn't exist

pos string

(optional) either "bottom" or "top" where "bottom" is furthest to the right of the window and "top" is furthest to the left Card.create(new Notification(posted).board().createList("ToDo"),{name: "Do this!"});

Source:
Example
Card.create(new Notification(posted).board().createList("ToDo"),{name: "Hi there!"});

(static) this.customFields()

Return a list of custom fields

Source:
Example
new Notification(posted).board().customFields().first().name();

(static) this.del()

Delete this board

Source:
Example
new Notification(posted).board().del();

(static) this.findOrCreateList(name, pos)

Find an existing list, creating it if it doesn't exist

Parameters:
Name Type Description
name string

the name of the list to find, creating it if it doesn't exist

pos string

(optional) either "bottom" or "top" where "bottom" is furthest to the right of the window and "top" is furthest to the left Card.create(new Notification(posted).board().findOrCreateList("ToDo"),{name: "Do this!"});

Source:
Example
Card.create(new Notification(posted).board().findOrCreateList("ToDo"),{name: "Hi there!"});

(static) this.id()

Return the board ID

Source:
Example
new Notification(posted).board().id();

(static) this.inviteMemberByEmail(email, type)

Add a member to the board by email address

Parameters:
Name Type Description
email string

the email of the user to invite (can be new or existing Trello user)

type string

admin or normal, defaults to admin

Source:
Example
new Notification(posted).board().inviteMemberByEmail("user@example.org");

(static) this.label(name)

Return a Label from this board by name (or regex match)

Parameters:
Name Type Description
name string | RegExp

the name or a regex of label to return

Source:
Example
card.addLabel(new Notification(posted).board().label("Urgent"));

(static) this.labels(name)

Return all labels from this board, optionally filtered by name (or matching regex)

Parameters:
Name Type Description
name string | RegExp

the name or regex to use when filtering the labels

Source:
Example
new Notification(posted).board().labels(new RegExp("Process.*")).each(function(label)
{
    card.addLabel(label);
});

Return the link to this board

Source:
Example
card.attachLink(new Notification(posted).board().link());

(static) this.list(name)

Return a List from this board by name (or RegExp)

Parameters:
Name Type Description
name string | RegExp

a list name or regex to match will just return the first matching list

Source:
Example
new Notification(posted).board().list("ToDo").cards().each(function(card)
{
    card.postComment("@board Get 'er done!");
}

(static) this.lists(name)

Return all List objects from this board optionally filtered by name/regex

Parameters:
Name Type Description
name string | RegExp

a name or regex to filter the list by

Source:
Example
new Notification(posted).board().lists(new RegExp("A.*")).each().function(list)
{
    try
    {
        list.cards().first().postComment("@board me first!");
    }

    catch(e)
    {
        Notification.expectException(InvalidDataException,e);
        Card.create(list,{name: "There must be at least one"}).postComment("@board me first!");
    }
});

(static) this.load()

Clear cached data and load via API call again. This may be required sometimes if you have modified data on a board and need to reload it. This method can be chained so it's easy to stick a load() call in where you need one, but shouldn't be done habitually to reduce the total number of API calls you need to make

Source:
Example
new Notification(posted).board().load().lists();

(static) this.makePersonal()

Make this a personal board (remove from any team) will not effect membership of the board DEPRECATED: Looks like personal boards aren't allowd in Trello anymore

Source:
Example
new Notification(posted).board().makePersonal();

(static) this.member(name)

Fetch a member of the board by name

Parameters:
Name Type Description
name string | RegExp

a string or regex to match to a member. Will only return one member, ie. the first matching the name or regex.

Source:
Example
card.addMember(new Notification(posted).board().member("iaindooley"));

(static) this.members(name)

Fetch a list of members, optionally filtered by name or regex

Parameters:
Name Type Description
name string | RegExp

an optional filter to restrict the list of members returned by username

Source:
Example
new Notification(posted).board().members().each(function(member)
{
    card.addMember(member);
});

(static) this.moveToTeam()

Move this board to a different team

Source:
Example
new Notification(posted).board().moveToTeam(new Trellinator().team("New Team"));

(static) this.name()

Return the board name

Source:
Example
new Notification(posted).board().name();

(static) this.removeMember(member)

Remove a Trello member from a board

Parameters:
Name Type Description
member Member

a Member object to remove from this board

Source:
Example
new Trellinator().board("Some Board").removeMember(new Notification(posted).member());

(static) this.setName(name)

Change the name of the board

Parameters:
Name Type Description
name string

the new name for the board

Source:
Example
new Notification(posted).board().setName("New Name");

(static) this.shortId()

Return the short ID to this board

Source:
Example
card.attachLink(new Notification(posted).board().shortId());

(static) this.team()

Move this board to a different team

Source:
Example
new Notification(posted).board().moveToTeam(new Trellinator().team("New Team"));

(static) this.unArchive()

Unarchive this board

Source:
Example
new Notification(posted).board().del();