When I am trying the below code. In which I am first fetching the list of Board Admins and adding a group say "Test_Group" in that list and updating the same Board admins with the new list. It is throwing an error "Not Implemented". But when I am fetching board admins from 1 board and adding a group and updating some other board with the new list it is updating successfully. But my task is to fetch from first board and update the first board only with the new admin list.
import com.atlassian.greenhopper.service.rapid.view.BoardAdminService
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.greenhopper.service.rapid.ProjectRapidViewService
import com.onresolve.scriptrunner.runner.customisers.PluginModuleCompilationCustomiser
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.greenhopper.model.rapid.BoardAdmin
import com.atlassian.greenhopper.model.rapid.RapidView
import com.atlassian.greenhopper.manager.rapidview.RapidViewManager
import com.atlassian.greenhopper.service.rapid.view.RapidViewService
import com.atlassian.greenhopper.manager.rapidview.BoardAdminManagerImpl
//import com.atlassian.greenhopper.manager.rapidview.RapidViewManagerImpl
def rapidViewService = PluginModuleCompilationCustomiser.getGreenHopperBean(RapidViewService)
//def rapidViewManager = PluginModuleCompilationCustomiser.getGreenHopperBean(RapidViewManagerImpl)
def groupManager = ComponentAccessor.getGroupManager()
def BoardAdminManager = PluginModuleCompilationCustomiser.getGreenHopperBean(BoardAdminManagerImpl)
def projectRapidViewService = PluginModuleCompilationCustomiser.getGreenHopperBean(ProjectRapidViewService)
/*Fetching Boards using Project Key*/
def boards = projectRapidViewService.findRapidViewsByProject(
ComponentAccessor.jiraAuthenticationContext.loggedInUser,
ComponentAccessor.projectManager.getProjectByCurrentKey("XYZ")
).value
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def boardAdminService = PluginModuleCompilationCustomiser.getGreenHopperBean(BoardAdminService)
def rapidView = boards[0]
def rapidView1 = boards[1]
/*Fetching Board Admins of any particular board*/
def boardAdmins = boardAdminService.getBoardAdmins(rapidView)
def newAdmin = groupManager.getGroupObject("Test_Group")
def boardAdmin = BoardAdmin.builder().type(BoardAdmin.Type.GROUP).key(newAdmin.name).build()
/*Adding the existing list with a new group*/
def boardAdmin1 = boardAdmin1 = boardAdmins + [boardAdmin]
/*Updating the list*/
BoardAdminManager.updateBoardAdmin(rapidView,boardAdmin1)
Please help me asap. Thanks in advance!!
What's the significance of assigning boardAdmin1 twice?
def boardAdmin1 = boardAdmin1 = boardAdmins + [boardAdmin]
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.