How to fire an event using Script Runner when custom multi user field gets updated?

Hi,

I want to fire an event using Script Runner when a custom multi user field is changed. The users in this field should get a notification after the change of the field. What is the correct condition to fire the event? In the best case only newly added users to the custom field will be notified.

Thanks in advance
Thorsten

2 answers

1 accepted

Hi Thorsten,

In such a case you could use event.eventTypeId:

import com.atlassian.jira.event.type.EventType
if (event.eventTypeId == EventType.ISSUE_CREATED_ID) {
    true
} else if (event.eventTypeId == EventType.ISSUE_UPDATED_ID) {
    changeItems.any { it.field=='my multi user field' }
}

Hope that helps

Hi Alejo,

 

it works.

Thank you very much.

 

Best Regards
Thorsten

Hi Thorsten,

For that purpose you can create a Script Listener of type "Send a custom email".

In the configuration of that listener you will need to add a condition similar to the following one:

changeItems.any {
    it.field=='my multi user field'
}

And also add your custom field id to the "

Hi Alejo,

 

thank you very much. It works.

But in the case I create the issue it doesn't work. I selected both events issue created and issue updated. But I think that the condition is not true because only the update case is covered. Can I change the condition so that also the create case is covered?

 

Best Regards
Thorsten

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,802 views 11 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot