Hi all,
I am wondering, if it is possible to use the value for auto assignment of an issue in a post function right after it has been created.
Scenario:
During issue creation, I have the option to either choose an engineer as assignee, select "Automatic" or select "Unassigned".
In case of "Automatic", I would like to have the reporter be set as assignee, while "Unassigned" shall stay unassigned.
The function to populate the assignee if it is empty is running in a post function via Script Runner. However, I did not find a way to check, whether "Automatic" or "Unassigned" has been chosen during creation.
Is that even possible? Or is there another way to resolve the "Automatic" to assign the reporter based on issue types?
Thanks!
Welcome to the Atlassian Community!
"no", is the short answer.
Detecting "automatic" is the problem. That choice is not actually stored anywhere, by the time you get to a post function, Jira has worked out who the assignee should be and populated the field in the working draft of the issue that will eventually be written to the database. Post-functions have access to that draft, but issue.assignee in there will have a user in it, not "automatic".
But you could fool it a bit. The "automatic" selection works off a couple of project settings.
So, my trick here would be to mildly abuse the "project lead". Set the default assignee to be the project lead, then all the components to project default or project lead. Then you can code for "if assignee = Bob, the project lead is selected, override it with the reporter".
The problems with this are:
Thanks Nic for that idea.
I was also thinking about setting a default user. Thinking about this, will the replacing user be notified about the issue creation if the dummy user is set by default? I believe it should because the Issue Created Event will be fired as the last post-function but I am not sure how Jira handles such changes.
Do you have experience in this?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
They should be, as you say, the event is fired after the issue is built and written to the system.
The way events work is they are a little bundle of information about what just happened. They go into the event handler queue for listeners and automations to react to, including the notification system.
A create event contains a reference to the new issue, and the new issue has the replacing user on it. So I would expect them to be notified!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.