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

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

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.

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.

 

>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.

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

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

26,862 views 2 7
Join discussion

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