What is the different between script runner event:Issue Updated/CustomFieldUpdatedEvent ?

Cloud October 31, 2017

Hi Support,

What is the different between script runner's event:

Issue Updated/CustomFieldUpdatedEvent ?

Because I write a custom listener script to judge the customfield's value,when the condition is true then auto clone the issue to other projects.

I set the event: Issue Updated/CustomFieldUpdatedEvent.

I find a bug that when the custom field condition is true, it auto clone the issue(it is correct),but users upload the attachment three times,it also auto clone issue to other projects(it is wrong).

Is it jira's bug?We use JIRA 7.2.6 version.

Should I  just need to remove Issue Updated to  avoid this problem.

Thanks for your great support in advance.

1 answer

0 votes
Domenico Manzo _Actonic_
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 31, 2017

Issue Updated: Triggered if some field of the issue is changed.

CustomFieldUpdatedEvent: Triggered if the name or description of the field is changed. 

Cloud October 31, 2017

Should I  just need to remove Issue Updated to  avoid this problem?

Domenico Manzo _Actonic_
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 31, 2017

It depends on your requirements. 

Cloud October 31, 2017

We only want to auto clone issue when the custom field condition meet the requirement.

What should I need to put ?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 31, 2017

Please note that these are not "script runner events".  The events are fired by activity in Jira, and you're using Script Runner to react to them.

From "We only want to auto clone issue when the custom field condition", I think you need to forget CustomFieldUpdatedEvent.

It sounds like your requirement is "Clone issue if a custom field changes to <a value>".  You will need the IssueUpdated event for that, and to then check the value of the custom field as the condition.

If my guesses there are wrong, could you clarify the requirement a bit more?

Cloud October 31, 2017

The questions is that I have already set the custom field to meet some condition and then to auto clone the issues,but when users update the attachment it also meet the condition then auto clone the issue,but this issues should not auto clone.

What should I need to avoid this problem?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2017

Sounds like the condition is incorrect.  Are you checking just for a change of that custom field?  Could you show us the config?

Cloud November 1, 2017

The condition is correct,but if you just use IssueUpdated event then the condition is always true then someone update the issue ex:upload an attachment it also auto clone issue,but it is wrong.

Do you have any suggestions about it ?

Aidan Derossett _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.
November 2, 2017

Hey Cloud!

So are you wanting the issue to only be cloned when a certain field is updated in an issue? If so, but the clone is being made when some other field is being updated, then I'd agree with Nic in that your condition is probably wrong. If, however, the attachment field is actually the field that is supposed to trigger the event, then I imagine your issue is that you need to check for if a clone of the issue already exists; and not to make another one if it does.

Could we please take a peek at your listener config and condition to get a better idea of what might be happening in your code?

Thanks! 

Aidan

Cloud November 2, 2017

1.So are you wanting the issue to only be cloned when a certain field is updated in an issue?

YES

2. If so, but the clone is being made when some other field is being updated, then I'd agree with Nic in that your condition is probably wrong. 

No,Because I put IssueUpdated event and the field have already changed to my trigger condition and then happen issue updated then it is auto clone?Is it correct action?

Cloud November 3, 2017

Could we please take a peek at your listener config and condition to get a better idea of what might be happening in your code?

Could you please give me the mail address ?

Cloud November 5, 2017

Hi Support, please help to solve this problem as soon as possible.

Katy Kelly
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.
November 6, 2017

Hi Cloud, 

Please post it below and we will follow up with you.

Katy

Adaptavist Product Support 

Cloud November 7, 2017

Hi Support,

Because issue updated event include all event like update issue and upload file.

We need to judge only when customfield update then auto clone the issue ,thank you!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 8, 2017

This is correct.  An issue updated event tells us the issue has changed, and how. 

Your condition needs to look specifically at one field within that.  SR can do that easily, but it sounds like you have not configured it correctly.

Please, tell us what you have configured for this.  We can't really help you until you tell us that.

Aidan Derossett _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.
November 9, 2017

Hey Cloud!

If you need to judge which custom field is the one that has been updated, you can use something like the ChangeHistoryManager to see exactly which field was the updated field.

For example:

def chm = ComponentAccessor.changeHistoryManager
def changeHistory = chm.getAllChangeItems(event.issue)

// check that the field changed was the specified custom field
if(changeHistory.field.last() == "Custom Field Name")
{
//Execute the rest of your listener code
}

That should allow you to control which field the listener fires on. But if you have an issue with a condition somewhere else in your listener, this won't be a solution. But try to implement that and test it out. Then let us know how it goes! :D

Best of Luck!

Aidan

Cloud November 9, 2017

Hi Support,

Good Job,That is what I need.

So I only need to put Issue updated event and remove customfield updated event to test these code?

Thank you. 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2017

Yes, as discussed before, the "custom field updated" event is for changes to the configuration of the custom field itself, not the values held in it for issues.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events