Script Listener - Issue Assigned



In my company, we have developed a Custom listener for the Issue Assigned Event that, after performing some validations to the "new" Assignee, it maintains, "clear" or modify the Assignee for that Issue. This works perfectly when we directly change the Assignee or by"Edit" button.
However, if the Assignee is changed on a Transition (we have the Assignee field on a screen that is shown during a status transition), the script runs (we have some emails that are sent via script during the validations), however, the Assignee does not change.

The "way" we are using to change assignee is:



And the Post Function that we have in a transition are, for example, as follows:

  1. Set issue status to the linked status of the destination workflow step.
  2. Add a comment to an issue if one is entered during a transition.
  3. Update change history for an issue and store the issue in the database.
  4. Re-index an issue to keep indexes in sync with the database.
  5. Fire a Generic Event event that can be processed by the listeners.


We have already tried to put the listener code between the "steps" (Post Functions) of the Transition, as well as in a Generic Event type Event (on Script Listeners), but the Assignee does not change (all code goes well, just does not change the Assignee)


Best Regards.

1 answer

1 accepted

1 vote
Accepted answer


I do not understand how you tried to put the listener code between the steps. Listener fires when an event, which the listener listens, fires. I would put log.error message in your listener and see in the logs if the listener fires or not.  If the listener fires, but the assignee is not changed then something is wrong with your code, if the listener does not fire then you should make it fire by adding Generic event to the listener.

Hello Alexey,

Thank you very much for your reply.

We have placed the code in a Post Function, properly configured to change the Assignee in the Issue (the code is not exactly the same as on the Listener).
No error is returned. The code runs perfectly, all logs are successful, including the information that assignee changed, however, when the screen is closed, the assignee remains the one we choose manually on the screen and not what should be replaced by code (replacing the manually inserted).
We have already put it as Generic event and it happens the same.
By changing the Assignee directly or in the edit window, everything runs as expected and completely "error-free". When we change assignee on a status transition screen, it also does not return any errors, everything runs fine (on the "background") however, as soon as the screen closes, the assignee has not been replaced by what the code should have replaced.


Thank you again.

Ok. Kindly change your script to this one . I think the problem is with;

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

and you need to add an import

import com.atlassian.jira.event.type.EventDispatchOption

Try it with a post-function first. Put your post-function before reindexing

Hi Alexey,

This worked. Thank you very much.
If I put it this way only in the Listener it still does not work in the workflow transitions, but putting it in the Post Functions already works correctly. This way, I put the code (custom and with the "pieces" that you sent) in Post Function, so, what I intend is done here soon, so when it arrives at Listener everything is already as intended. I also let the Listener stay as it was and when we change Assignee directly, it works as it always did.

Thank you so much again.

Best regards.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,084 views 4 9
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