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

This widget could not be displayed.

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

This widget could not be displayed.

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 Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

55 views 0 1
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