How to auto populate value from Custom field to Assignee(System field) in JIRA?

JIRA_USER April 28, 2017

Hello All,

I am trying to make some changes on my JIRA project where I have a Customfield (Single select or Free Text Type) and Assignee (system Field). When I create a Bug or Changes Assignee in any Transition, I would be using my Customfield to add the username and I want that username to be auto populate into Assignee field. But, if the username listed in Customfield does not exist as an active user in JIRA project, set the Assignee to Automatic or Unassigned. Where as if the username listed in Customfield exist as an active JIRA project user, copy that username from Custom field to the Assignee field. 

How do I do this?

I tried to do this in Post function via "Copy value" function. It works only when the username listed in Customfield is an active jira project user. If the user listed in Customfield is no active jira project user, I get error message "Error creating issue: Unable to copy value from field '<customfield> to 'Assignee''".

2 answers

0 votes
Sanjay April 30, 2017

Hi,

Basically assignee field can have only a jira active user. Here, you are trying to set the assignee field with a wrong value and thats why the error is. 

It is as same as if you go to UI and type a user in assignee field, you will get a list of active users only. You can't put a wrong value there and update the assignee field.

Solution : You can write a postfunction where there will be a check that the value in customer field is a valid user then copy value.

Else populate assigne with unassigned.

Regards,

Sanjay

JIRA_USER May 1, 2017

Hi Sanjay,

Exactly, my approach was the same but I am not there yet. I am new to groovy/jira so may be I am not able to put the correct script on the right place. Would you please help me to acomplish the solution?

 

Thanks in advance.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2017

When you are assigning an issue to someone, it must be someone that is currently allowed to be the assignee. 

Check the project permissions and amend them so that the target people can be assigned issues in that project.

JIRA_USER April 28, 2017

Hi Nic,


The issue here is not about wheather I am able to assign the bug or not. The issue is that, if my user "xyz" is not an active jira user, the post function rule cannot copy the value from my customfield to the Assignee field and not able to create the bug. Hence, is theer a way to over come this issue? Or can thisbe done from Behavior plug in?


Requirements are:


1) Customfield = abc, Auto populate abc to Assignee field. Here, the user abc exist in JIRA project as a active user.


2) Customfield = xyz, Auto populate "Unassigneed" to Assignee field. Here, the user xyz does not exit in JIRA project as an active user.

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2017

>The issue here is not about wheather I am able to assign the bug or not

It absolutely is about this.  Your function is failing because the user is not a valid assignee.

It's not an issue, it's not something you can break with a Behaviour or botch.  The person you are trying to name as the assignee must be an assignable user.

Suggest an answer

Log in or Sign up to answer