ScriptRunner can't change dashboard owner for inactive user?

Daniel Bower September 19, 2016

We have a user that left the company.  They are owner of 70+ filters/dashboards.  I just purchased a license for the latest version (4.1.3.15 ) of ScriptRunner since the old free version has a bug with changing ownership.  I tested out the script and it worked fine for two active users.  However, for the user that left the company, they are inactive (and we use Active Directory for logins, so I don't have control over that).  When I use his email address for the "From" id and an active user for the "To" Id, the Dashboard and Filter IDs never populate.

Any thoughts or workaround for this scenario?

3 answers

1 vote
Kelly Arrey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2019

This now works "out of the box" in Scriptrunner for JIRA 5.5.5 !  Thanks Adaptavist, this makes life easier for JIRA admins !

1 vote
Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 22, 2016

So, this is actually a side effect of the fact that the user picker field can't display inactive users.

Since the "From" and "To" fields are actually user picker fields, they won't work if a proper user isn't returned from JIRA's built-in user picker REST endpoint.

One temporary workaround might be to call the built-in script via REST, though you'd have to know the IDs and such of the Dashboards.

Since this is a big use case for the change ownership feature, I'm going to see if we can't raise this as a bug for future development.

Jonathan Chatwin December 13, 2017

I've been running into this of late. Wish you could just type the user name instead of using the picker. Although if REST can do it then that probably works. 

Thanks for the tip! 

Jonny Carter
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 13, 2017

No sweat. Here's the feature request, by the way. https://productsupport.adaptavist.com/browse/SRJIRA-2384

Jonathan Chatwin December 14, 2017

Nice, voted and watched that on Adaptavist support... 

0 votes
Jason Kemp August 22, 2018

I ran into this problem, and was able to get this fixed using the script console and code taken from here: https://productsupport.adaptavist.com/browse/SRJIRA-762

 

import com.onresolve.scriptrunner.canned.jira.admin.ChangeSharedEntityOwnership

Map<String, Object> inputs = [
    (ChangeSharedEntityOwnership.FIELD_FROM_USER_ID) : "olduser",
    (ChangeSharedEntityOwnership.FIELD_TO_USER_ID) : "newuser",
    (ChangeSharedEntityOwnership.FIELD_DASHBOARD_IDS) : ["1234"]
]

def changeSharedEntityOwnership = new ChangeSharedEntityOwnership()
assert ! changeSharedEntityOwnership.doValidate(inputs, false).hasAnyErrors()
changeSharedEntityOwnership.doScript(inputs)

Replace the olduser, newuser, and the dashboard ID(s) (taken from the DB).

Suggest an answer

Log in or Sign up to answer