Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Listener din't capture [Status change] event but [customfield change] instead

蓝胖
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2021

Here is the changed items

ChangeHistoryItem{id=278663, changeGroupId=202468, userKey='JIRAUSER11313', field='addr_doc', projectId=10400, issueId=64081, issueKey='abc-3162', created=2021-10-25 17:39:35.0, nextChangeCreated=292278994-08-17 15:12:55.807, fromValues={}, toValues={}}

The status change wasn't captured by listener. However, a status change did happen at the same time. This happens from time to time, but does not happen every time.

It should be like this 

ChangeHistoryItem{id=278557, changeGroupId=202410, userKey='JIRAUSER11462', field='status', projectId=10400, issueId=64080, issueKey='abc-3161', created=2021-10-25 17:23:28.0, nextChangeCreated=292278994-08-17 15:12:55.807, fromValues={10124=xxxstate}, toValues={10106=yyystate}}

How can I make sure the status change captured? Or is there a way to obtain the status change during the same change using jira API? (I'm using scriptrunner groovy language)

 

I use code below to capture the event

def issue=event.getIssue() // get issue which triggered listeneer


// this below is list of updates of <issue>

def changeItems = ComponentAccessor.getChangeHistoryManager().getAllChangeItems(issue)
def length = changeItems.size() // length of this list

def changeF = changeItems[length-1].getProperties()["field"]

if( changeF == "status"){

My further behaviours}

 

 

---------------------------------

Just found out that actually there were more than 1 changes made in the same time (even 4 at a time) and "status" change will always be the first to fire. Thus if I were to search for status change backwards, I need to read 4 or 5 more changes and check them

1 answer

0 votes
Nic Brough -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.
October 25, 2021

My guess would be that your workflow is firing a different event to the one you are expecting it, so the listener is not picking it up.

蓝胖
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 25, 2021

Just found out that actually there were more than 1 changes made in the same time (even 4 at a time) and "status" change will always be the first to fire. Thus if I were to search for status change backwards, I need to read 4 or 5 more changes and check them

Suggest an answer

Log in or Sign up to answer