Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Does the issue update with HAPI throw an issue update event (and notification)?

Lara Lopez October 26, 2023

Hello,

I have an scripts that goes through 100 of issues to update a field. I do not want to spam everyone with emails but I cannot find in the documentation if when I use HAPI I can disable emails.

If I have a script similar to this

Issues.search('project = ZOO').each { issue ->
dadadadad
}
issue.update {
        setCustomFieldValue('CF', value)
}
Does this throw an issue updated event, and therefore a notification? I see it in the issue history so I guess yes? Is there a way for me to disable the notification?
(I know that I can remove the notification scheme but you used to be able to disable it in the code)
Thanks!

1 comment

Comment

Log in or Sign up to comment
Reece Lander _ScriptRunner - The Adaptavist Group_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 26, 2023

Hey!

By default the issue update will fire an event and send an email, this however can be opted out, which is a good idea when doing bulk updates.

I see that this option is omitted from our documentation, I'll get that fixed up right away.

 

import com.atlassian.jira.event.type.EventDispatchOption

issue.update {
setSummary('New summary')
setEventDispatchOption(EventDispatchOption.DO_NOT_DISPATCH)
setSendEmail(false)
}
Like # people like this
Lara Lopez October 26, 2023

Thank you so much! You cant imagine how much I needed this!

Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2023

Thanks @Reece Lander _ScriptRunner - The Adaptavist Group_ 

I tried looking for anything related to this in the documentation including the JavaDocs. Doesn't seem to be there yet.

Can you help provide some clues as to where in the JavaDocs the various methods available in those update methods (listed as Closure<?>specification ) can be found?

Also, I was not able to identify if there is a similar method for Assets.

E.g.

import com.riadalabs.jira.plugins.insight.services.events.EventDispatchOption

def object = Assets.getByKey('KEY-123')
object.update {
setEventDispatchOption(EventDispatchOption.DO_NOT_DISPATCH)
setAttribute('AttributeName', 'new value')
}

All or most ObjectFacade methods have an signature that includes an EventDispatchOption.

It would be nice to be able leverage that via HAPI.

Like jira_ub ub_edu likes this
TAGS
AUG Leaders

Atlassian Community Events