I want to get boards connected to specific project using ScriptRunner and Jira Java API.
According to documentation there is interface called BoardManager which includes method called getBoardsForProject(long projectId). This sounds like exactly what I need but for some reason, no matter the project, it always returns null.
Here's my ScriptRunner code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.board.Board
import com.atlassian.jira.board.BoardManager
def boardManager = ComponentAccessor.getComponent(BoardManager);
def b = boardManager.getBoardsForProject(12401);
return b;
When using the same project id in REST API call /rest/agile/1.0/board?projectKeyOrId=12401, I'm getting the Boards I'm expecting. I know, it is possible to use REST API calls in ScriptRunner as well, but this is something I don't want to do.
Any ideas, how to modify my script to get the needed data?