I have a script that updates the Assignee on sub-tasks when the Assignee is changed on the parent issue type. It's an event listener that was originally listening just for issueUpdated event. This was working fine when the parent issue was edited and/or the assignee field was changed inline from the view screen.
The only time that this appears to not work when I want it to is when the "Assign to me" button is clicked on the view screen. After some research, I thought that also listening for the issueAssigned event would solve this problem. I added the event to my listener and it didn't fire when clicking "Assign to me". I thought that maybe some other event was being fired since only 1 would trigger if there were multiple competing events. I changed my event listener to pick up on workflowEvent & printed out the event id. No events were triggered when I clicked the "Assign to me" button again (I verified it picked up on the issueUpdated event when changing the Assignee field inline).
Why isn't an event being fired when the Assign to me button is clicked on the issue view screen? More specifically, why isn't the issueAssigned event being fired?
JIRA 6.4.6 - Script Runner 4.1.3.4
Community moderators have prevented the ability to post new answers.
Hi Andrew,
Having taken your code if I simplify it down to become the line shown in the code block below and configure it as per the screenshot shown below then I get a log message output when the assignee is updated on the View or Edit Screen.
log.warn("Event: ${event.getEventTypeId()} fired for ${event.issue}.")
config.png
The output I see in the Logs is shown below.
// Inline edit clicked on View Screen: 2016-01-08 17:09:57,363 http-bio-8080-exec-7 WARN kwalker 1029x2996x1 1ee91b0 86.2.223.6,0:0:0:0:0:0:0:1 /secure/AjaxIssueAction.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Event: 2 fired for KDP-12. // assign to me link clicked on view screen: 2016-01-08 17:10:01,328 http-bio-8080-exec-7 WARN kwalker 1030x3003x1 1ee91b0 86.2.223.6,0:0:0:0:0:0:0:1 /secure/AssignIssue.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Event: 3 fired for KDP-12. // Edit Screen assignee field edited: 2016-01-08 17:11:59,970 http-bio-8080-exec-3 WARN kwalker 1031x3086x1 1ee91b0 86.2.223.6,0:0:0:0:0:0:0:1 /secure/QuickEditIssue.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Event: 2 fired for KDP-12. // Edit Screen assign to me link clicked: 2016-01-08 17:13:01,834 http-bio-8080-exec-3 WARN kwalker 1033x3139x1 1ee91b0 86.2.223.6,0:0:0:0:0:0:0:1 /secure/QuickEditIssue.jspa [onresolve.scriptrunner.runner.ScriptRunnerImpl] Event: 2 fired for KDP-12.
Can you please try configuring the listener like this and see if this provides the results expected.
Many Thanks
Kristian
Hi Andrew, I am glad I was able to help your solve your problem. Thankyou for accepting my answer. Many Thanks Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrew,
In order for this issue to be looked into further can you please provide the code for the Script Listener as well as the atlassian-jira.log file entries for when this issue occurs if you are still experiencing this issue.
Many Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've experienced this same behavior with other actions (comments, updates, etc). From the view page it seems that scriptrunner does not always catch the events. Is there any update to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kristian Walker (Adaptavist) thanks for the response. I've trimmed down the script to the relevant info.
package com.custom import com.atlassian.jira.event.issue.AbstractIssueEventListener import com.atlassian.jira.event.issue.IssueEvent import org.apache.log4j.Category class AutoAssignChangeItemsOnProblemAssigneeChangeListener extends AbstractIssueEventListener{ private static final Category log = Category.getInstance(AutoAssignChangeItemsOnProblemAssigneeChangeListener.class) @Override void issueUpdated(IssueEvent event){ log.warn("issueUpdated event fired!") checkProblemAssigneeChange(event) } @Override void issueAssigned(IssueEvent event){ log.warn("issueAssigned event fired!") checkProblemAssigneeChange(event) } }
After adding this listener I tried 3 different things and noted what was produced in the catalina.out log file (I emptied the log file right before doing these actions so there isn't anything else there):
2016-01-06 09:45:54,612 http-bio-8080-exec-60 WARN andy_boutin 585x15740x1 1nz65wc 10.127.249.200 /secure/AjaxIssueAction.jspa [com.custom.AutoAssignChangeItemsOnProblemAssigneeChangeListener] issueUpdated event fired!
2016-01-06 09:46:34,976 http-bio-8080-exec-59 WARN andy_boutin 586x15764x1 1nz65wc 10.127.249.200 /secure/QuickEditIssue.jspa [com.custom.AutoAssignChangeItemsOnProblemAssigneeChangeListener] issueUpdated event fired!
Then I changed the script to
package com.custom import com.atlassian.jira.event.issue.AbstractIssueEventListener import com.atlassian.jira.event.issue.IssueEvent import org.apache.log4j.Category class AutoAssignChangeItemsOnProblemAssigneeChangeListener extends AbstractIssueEventListener{ private static final Category log = Category.getInstance(AutoAssignChangeItemsOnProblemAssigneeChangeListener.class) @Override void workflowEvent(IssueEvent event) { log.warn("Event: ${event.getEventTypeId()} fired for ${event.issue}.") } }
After adding this listener I tried the same 3 actions and noted what was logged (I emptied the log file right before doing these actions so there isn't anything else there):
2016-01-06 10:58:51,125 http-bio-8080-exec-54 WARN andy_boutin 658x16268x1 1nz65wc 10.127.249.200 /secure/AjaxIssueAction.jspa [com.custom.AutoAssignChangeItemsOnProblemAssigneeChangeListener] Event: 2 fired for SCOS-8269.
2016-01-06 10:59:14,258 http-bio-8080-exec-37 WARN andy_boutin 659x16287x1 1nz65wc 10.127.249.200 /secure/QuickEditIssue.jspa [com.custom.AutoAssignChangeItemsOnProblemAssigneeChangeListener] Event: 2 fired for SCOS-8269.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.