Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Auto-Assign During Creation NOT working After Jira Upgrade to v8.5.3

Raj Ghimire
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 16, 2020

We have an existing process in our current JIRA v7.10.2 where  we use nFeed Plugin to automatically pull Manager's Username from AD synced DB.  ..During creation Transition, Jira Auto-assigns the Tkt to that Username (AD Username is Jira Username too).  There are Multiple other actions that happen after the manager gets assigned.  Custom email. alerts etc. etc.  ... However, recently, after our Jira Server Application got upgraded from JIRA v7.10.2 TO Jira v8.5.3 in our Test env, our Auto-assign Manager script is NOT working there anymore. After Creation, Assignee field only shows this value:   {"keys":["username"]}  ... The problem seems to be tied to Jira not being able to parse the Username field and associate it to an actual Jira user.

The logs show the error: 

  • Failed to perform async task: No user exists with the key {"keys":["username"]}

Can anyone suggest me what I need to do to resolve this Please?  I am including the script I am using in that Create Issue Transition.

 

#import com.atlassian.jira.component.ComponentAccessor
from com.atlassian.jira.component import ComponentAccessor
from com.atlassian.jira.user import UserUtils
from HTMLParser import HTMLParser
import com.xhaus.jyson.JysonCodec as json
import sys

# Declare the list. myparse function writes to a global list
htmlData = []

# Used to parse html data. Fields like repsonsibility provide data in html.
class myparse(HTMLParser):
def handle_data(self, data):
if data.strip() != '': # remove white lines
htmlData.append(data.strip())

# Function to parse html fields. Pass the data from the field and it will
# return the value of the field as a list
def parseHtml(data):
htmlField = myparse()
try:
htmlField.feed(data)
tmp = list(htmlData)
except:
tmp = ['']
del htmlData[:]
return tmp

## Define & Get actual value free of html/xml Codes
customFieldManager = ComponentAccessor.getCustomFieldManager()
userManager = customFieldManager.getCustomFieldObjectByName("Manager JIRA name")
userManagerHtml = issue.getCustomFieldValue(userManager)
userManagerValue = parseHtml(userManagerHtml)[0]


issue.setAssigneeId(userManagerValue);

 

1 answer

1 vote
Andy Heinzer
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 Champions.
March 18, 2020

Hi Raj,

I see that you are trying to auto assign users upon issue creation, but that since you upgraded Jira to 8.5.3, this script is no longer working.  I think I understand why that is. 

Jira Server started to make some changes to the format userkeys utilize starting with Jira server 8.2.  These are detailed in GDPR changes in Jira: Userkeys.  As the title indicates, these were made so that Jira Server could be more compliant with the GDPR regulations.

In all versions of Jira Server starting with 6.0 and those before 8.2, when a user account was first created in Jira, the userkey for that account would always be the exact same value as the original username.  The username could be renamed in Jira (at least starting with Jira 6.0), but he userkey value is never expected to change for the account. 

A note on these changes to userkey: This does not affect accounts that were in Jira before the upgrade.  It only affects newly created accounts after the upgrade, unless you have used the new Anonymizing users feature which can change a userkey.  Alternatively perhaps you created a fresh install of Jira 8.5.x and then created the user accounts anew there.  In that case all the userkeys would not match the usernames, but that behavior is now expected in that version.

I am not sure exactly the syntax your code will need to work, as I'm not very familiar with using groovy code in the manner you are here.  But I expect that you will have to alter this to look for the user's current username and assign based on that instead of looking up the userkey value. 

I hope this helps.

Andy

Suggest an answer

Log in or Sign up to answer