[Scriptrunner] Issue Updated event won't be fired if you call it from another issue

Ekaterina Danilova July 1, 2019

I have two issues: Employee and Access. They are linked to each other. 

When Access.Status = Done, I get the linked issue with the Employee issue type and store it in the employeeTask variable. Also, I need to update one Employee task custom field that I do by using the following code: 

et_specialAccessRightsField.updateValue(null, employeeTask, new ModifiedValue(employeeTask.getCustomFieldValue(et_specialAccessRightsField), specialARValues), new DefaultIssueChangeHolder());
issueManager.updateIssue(currentUser, employeeTask, EventDispatchOption.ISSUE_UPDATED, false)

I assume that the last string help to fire the Issue Updated event. 

However, as I can see the event isn't called, because my other code (listener) doesn't work. 

It's odd, however, if I change the field manually, the event will be fired and the listener will be work. If I changed this field from another issue, the updated issue event doesn't work =(

1 answer

1 accepted

0 votes
Answer accepted
Ilya Turov
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 1, 2019

Because "et_specialAccessRightsField.updateValue(...)" already updates issue, second row seems to do nothing hence firing no event. If you use

employeeTask.setCustomFieldValue(et_specialAccessRightsField, specialARValues)

instead of your first row I think it should work 

Ekaterina Danilova July 2, 2019

Wow, @Ilya Turov thanks! It works! 

Suggest an answer

Log in or Sign up to answer