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"?
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.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.