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.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline 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.