Hi,
Working on a cusom script runner listener that sets the sprint of a issue automatically. My problem is that when this happens the listener is triggered twice, first for the user action and a second time because the field gets set.
Any way to avoid this?
Br,
Tom
Community moderators have prevented the ability to post new answers.
I'm not sure how you are setting the sprint, please include your code.
There are ways to update an issue without firing an event, for example:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.IssueManager def issueManager = ComponentAccessor.getComponent(IssueManager) def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("...") def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def issue = issueManager.getIssueObject("JRA-327") issue.setCustomFieldValue(cf, 42) issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
If you use the IssueService to update it I don't think you can avoid firing an event, because it's a high-level interface that tries to emulate exactly the way the UI behaves.
You might try using the built-in function to add/remove an issue from a sprint.
The other way to set the sprint is using com.atlassian.greenhopper.service.sprint.SprintIssueService#moveIssuesToSprint, which may not fire an event.
Thank you for your reply! I'm using the SprintIssueService and it seems to fire an event.
Is is there a way to set the sprint field using only the setCustomFieldValue as you mentioned?
Or does the updateIssue call have an effect even when the issue passed by the event is not mutable and the SprintUssyeService is used? (Script runner is now insists on showing only "No failures in the last 15 execution(s)" so I get no feedback on if adding this had any effect)
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.