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''".
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.
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?
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.
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.
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.
You can check Atlassian documents on getting an idea of postfunctions
Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events