The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get a list of all board related to a specific project

Guy Geron
Contributor
January 14, 2020

Hi,

 

I'm trying to get a list of all the boards related to a specific project by using the following line:

List<Board> sourceProjectBoards = boardManager.getBoardsForProject(sourceProject.getId())

 

I'm getting the following error:

Error: java.lang.NullPointerException: Cannot invoke method getBoardsForProject() on null object

 

I understand that I need to get the boardManager object, but I can't figure out how to do that.

Initially I thought it will be similar to how I get projectManager or workflowManager, etc. Using the ComponentAccessor.

But it seemed to be not the case in this one. 

Any advice?

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Kaveh M Mehr
October 31, 2021

Hi 

It is too late  but the answer is 

ComponentAccessor.getComponent(BoardManager.class);

0 votes
Carlos Garcia Navarro
Community Champion
January 14, 2020

Hmm...My understanding is that projects and boards are not linked directly.

Guy Geron
Contributor
January 16, 2020

@Carlos Garcia Navarro  to my understanding there has to be some relationship. As when I'm navigating to a particular project, I get on the top left corner a list of all the boards that are associated with this project.