It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Cloud Oct 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 Oct 31, 2017 • edited

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

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

Cloud Oct 31, 2017

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

Domenico Manzo Oct 31, 2017

It depends on your requirements. 

Cloud Oct 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 Oct 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 Oct 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 Nov 01, 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 Nov 01, 2017 • edited

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 ?

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 Nov 02, 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 Nov 03, 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 Nov 05, 2017

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

Katy Kelly Nov 06, 2017

Hi Cloud, 

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

Katy

Adaptavist Product Support 

Cloud Nov 07, 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 Nov 08, 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.

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 Nov 09, 2017 • edited Nov 10, 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 Nov 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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar alert! An IT Admin's Guide to Securing Collaboration at Scale

Hello, Atlassian Community! My name is Dave Meyer and I'm a Principal Product Manager at Atlassian. I wanted to give this community a heads up about an upcoming Webinar that might be of interest...

186 views 2 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you