Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I have some dashboards that I need to change owners, although Jira has this option within the Built in script, this only allows me to do one by one and it would take a lot of time.(2000 - 5000 dashboard)
I was thinking of using the portalpage in jira, the getDashboardManager() method does not identify me
I leave an example of what I try to do with the jira console:
Thanks in advance
Hi @Benjamín Alexander Mella Marilao
Dashboard class do not exist. JIRA Dashboard are referenced as Portal page.
You have to use the following class
com.atlassian.jira.bc.portal.PortalPageService
com.atlassian.jira.portal.PortalPage
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've not tested it but it should not have changed since 7.0.4
This one should work for 8.20.X
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes the class path is
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Deprecated means that it will be removed at some point but it's working now. You can also use the recommanded function if it's availabl for your version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Benjamín Alexander Mella Marilao
This code should do the tricks:
Note that the currentUser have to be able to see the dashboard if it's not the case you have to get all dashbaord, then if dashboard id is in your list you update it, do nothing if it's not the case.
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.bc.portal.PortalPageServiceimport com.atlassian.jira.portal.PortalPageimport com.atlassian.jira.user.ApplicationUserimport com.atlassian.jira.bc.user.search.UserSearchServiceimport com.atlassian.jira.bc.JiraServiceContextImplimport com.atlassian.jira.portal.PortalPage.Builder
PortalPageService portalPageService = ComponentAccessor.getComponent(PortalPageService.class)UserSearchService userSearchService = ComponentAccessor.getComponent(UserSearchService)
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ApplicationUser targetOwner = ComponentAccessor.getUserManager().getUserByName("YYYYYYYY")
List<Long> portalIds = []
portalIds.each{ id->PortalPage dashboard = portalPageService.getPortalPage(new JiraServiceContextImpl(currentUser) , id)PortalPage.Builder builder = new Builder()builder.portalPage(dashboard)builder.owner(targetOwner)PortalPage updatedDashbaord = builder.build()portalPageService.updatePortalPageUnconditionally(new JiraServiceContextImpl(currentUser), currentUser, updatedDashbaord)}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.