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:
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)
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.
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 issue.store();
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
and you need to add an import
Try it with a post-function first. Put your post-function before reindexing
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.
Atlassian Summit is an excellent opportunity for in-person support, training, and networking.Learn more
Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in talking to 20 people planning t...
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!
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