Hi,
I tried to get all boards according to different projects by implementing a script in scriptrunner. Unfortunately, I'm not able to come to a result when I try to use BoardManager or BoardService.
Here is my code snippet:
projects.each{project->
log.debug"project: "+project.id
log.debug"project id class: "+project.id.getClass()
def b = boardManager.getBoardsForProjects(project.id)
log.debug(b)
}
And here you see the error message:
I do not understand why the signature of the method "getBoardsForProjects()" is not correct.
Thanks for your support in advance!
Best regards,
Günter
Hi Niranjan,
in the meantime I found another solution (which I also have tried yesterday, but it did not work which might have been caused by a specific copy and paste error or for whatever reason...). Here - if someone is interesting in the solution to list all agile boards - is the code which I have used in the Console of Scriptrunner (see also script examples concerning Jira Agile (boards) - many thanks to the author!) :
import org.apache.log4j.Level
import org.apache.log4j.Category
import org.apache.log4j.Logger
def log = Logger.getLogger("01.10.20")
log.setLevel(Level.DEBUG)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.greenhopper.model.validation.ErrorCollection
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.web.rapid.view.RapidViewHelper
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.pyxis.greenhopper.jira")
@JiraAgileBean
RapidViewService rapidViewService
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def errorCollection = new ErrorCollection()
def views = rapidViewService.getRapidViews(currentUser).value
// list names of current boards
views.each{board ->
log.debug(board.name)
}
BTW: I wasn't successful when I copied the code from create and link boards only. The compiler thrown an error and I had to add ".value" to "def views = rapidViewService.getRapidViews(currentUser)". Now it works as intended.
I assume and hope that I can go further on this basis...we will see ;-)
Thanks a lot for your engagement!
Best regards,
Günter
Hi Niranjan,
oh what a silly typo...thanks for this hint!! Now I don't get an error message from the system anymore.
But to be honest, I only reached the next question...the list of the boards as a result of the boardManager method "getBoardsForProject()" is empty, although the projects have boards.
So I guess there is another problem beneath the typo...any additional idea?
Thanks!
Best regards,
Günter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Günter Halmans - Could you try with entering one of the project ids directly? If that works, then we may need to look at the way how project ids are taken as input argument to the method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Niranjan,
I have entered the id 18807, but the result is still the same: empty (and I know that there is a board existing ;-)
Here the snippet:
def b = boardManager.getBoardsForProject(18807)
log.debug(b)
result: []
I also tried...
def b = boardManager.getBoardsForProject(18807 as long)
log.debug(b)
...same result.
BR, Günter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Günter Halmans - I believe that is getBoardsForProject(long projectId) and not getBoardsForProjects(project.id)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.