Is it possible to copy Full name instead of username to 'Assignee' field in Jira?

We have a CRM database that stores Full Names. We are required to assign tickets based on these values in CRM.

Hence we have a nFeed field that extracts values from database, and this value is then copied to the 'Assignee' field.

But this does not work as we are trying to copy Full Name to 'Assignee' field.

Any ideas/suggestions to make this work?

1 answer

0 votes

No.  The assignee field is effectively a list of user objects.  You need to give it the right user object for it to work.  Your nFeed field needs to work from user login ids, not name.

Our organisation uses numerical usernames like z12345 which are not at all user-friendly and hence we are using full names instead.

Will it be possible to copy full name to any other user field if not 'Assignee'? We can then copy it to Assignee.

No.  A user field contains a user object, the same way an assignee does.

It's utter nonsense to use something like the user's given name in a user field.  It has to be something that uniquely identifies them.  In many cases a given name can do that, but it allows for failures, and hence cannot be used. 

For example, imagine a Jira system that my family uses.  "Nic" is unique in the family.  But when my father-in-law Jim uses it, how does the computer know it is him and not his brother in law, Jim, or his cousin, Jim?  Even adding a surname won't solve it - they're Jim Barclay, Jim Dart and Jim Barclay

For a user field to work, it must be able to uniquely identify a user.  A full name fails that test.

The best you will be able to do is a text field that asks for a name and then tries to work out who it might be in your list of users, so it can populate assignee with the unique id it requires.  But you're going to have to do a lot of thinking and coding around how to deal with duplicate names, misspellings and non-matching entries.

I am trying to use this script but getting errors:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.bc.user.search.UserPickerSearchService;


CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();

def nFeedField = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_12345"));

def userPickerSearchService = ComponentAccessor.getComponent(UserPickerSearchService);
def assignee = userPickerSearchService.findUsers("nFeedField[0]);
issue.setAssignee(assignee);
issue.store();

Also is there any equivalent class for "com.atlassian.jira.bc.user.search.UserSearchService" for Jira 6.4.2 ? And also corresponding method for "findUsersByFullName" ?

Your "def assignee" line is totally wrong, have another look at it.

Will the findUsers() method not retirn username if full name is passed to it?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,707 views 17 21
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you