Hello,
I want to update a Field of an issue every time this issue is updated. To do that i am using a listener on the event "issue updated" with a little script:
def summary = event.issue.getSummary()
def type = event.issue.issueType.getName()
if (type == 'Epic') {
event.issue.update {
setEpicName(summary)
}
}However i imagine this it would create an infinite trigger of the "issue updated" event, as i am updating the issue with my script either.
Is this the case? or scriptrunner's scripts do not trigger events events like "issue updated"?
Community moderators have prevented the ability to post new answers.
I run some tests and the answer is yes.
The command
event.issue.update {... }will generate a new "issue updated" trigger.
if not used correctly the issue will be updated recursively many times.
I have solved the problem with this code:
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
Issue issue = event.getIssue()
def type = issue.issueType.getName()
def summary = issue.getSummary()
def epicName = issue.getEpicName()
if (type == 'Epic') {
if (summary != epicName) {
issue.update {
setEpicName(summary)
setEventDispatchOption(EventDispatchOption.DO_NOT_DISPATCH)
setSendEmail(false)
}
}
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am exploring possibilities. What is the benefit of automation other than simplicity of implementation?
anyway, the main question is if the script triggers automatically an event when i update an issue, or not
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.