Is it technically possible to fire an event without updating an issue?

Hello,

I wonder is it possible from technical point of view to fire an event (using Automation, Scriptrunner, or something else) and not update ChangeHistory of an issue in any way? Or maybe firing an event is always related to changes recored in issue history?

2 answers

1 accepted

Maybe somebody would find it useful in the future so I'm posting a final working solution using suggested dispatchEvent method and Escalation Service provided by ScriptRunner.

Inspired by: https://answers.atlassian.com/questions/35778186 I've modified a little the code and produced following script that I've put into escalation service that is fired periodically:

import com.atlassian.jira.event.issue.IssueEventBundle
import com.atlassian.jira.event.issue.IssueEventManager
import com.atlassian.jira.event.issue.IssueEventBundleFactory
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
 
Long EVENT_ID = new Long("10500")
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getUserManager().getUserByName('some_user')
 
IssueEventManager issueEventM = ComponentAccessor.getIssueEventManager()
IssueEventBundleFactory issueEventFactory = (IssueEventBundleFactory) ComponentAccessor.getComponent(IssueEventBundleFactory.class)
 
IssueEventBundle eventBundle = issueEventFactory.wrapInBundle(new IssueEvent (issue, null, user, EVENT_ID, true))
issueEventM.dispatchEvent(eventBundle)

The event("10500") is fired correctly, can be processed by listeners and there is no trace in history of an issue that something changed in the issue.

 

 

Hi Bartek

You can use JIRAs custom events, where you can fire them in a workflow transition. 

Hi Thanos,

Maybe I wasn't clear: can I fire an event without causing any change in a history of an issue?

When I fire an event as a part of a workflow transition then there is a change stored in a issue history that can be viewed by users and updatedDate will be changed (transition from one status to the other - event if it's status1 -> status1)

I would like to do it "silently" so the majority of users wouldn't know in any way that the event has been fired and for them nothing would happen.

Such "silent" event could be further caught by listener but no user would know about it.

Do you know if it is possible?

 

Bartek, 

Sorry, I misunderstood. Yes you can use the JIRA api - dispatchEvent to dispatchEvent (this is the how). Now there is the second part of the question, the when. You can create a scheduler plugin that will dispatch the event every <schedule time>.

You can also use ScriptRunner Service to schedule a dispatch event.

Or there may be other plugins who can help you with the "when" (but I am not sure therefore I will not risk a false answer) 

 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,308 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot