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

Bartek Zukowski July 8, 2016

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

3 votes
Answer accepted
Bartek Zukowski July 18, 2016

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.

 

 

0 votes
Thanos Batagiannis _Adaptavist_
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.
July 8, 2016

Hi Bartek

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

Bartek Zukowski July 8, 2016

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?

 

Thanos Batagiannis _Adaptavist_
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.
July 8, 2016

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 Sign up to answer