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

Thorsten Kiefer February 3, 2015

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

2 votes
Answer accepted
Alejo Villarrubia [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.
February 9, 2015

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

Thorsten Kiefer July 17, 2015

Hi Alejo,

 

it works.

Thank you very much.

 

Best Regards
Thorsten

2 votes
Alejo Villarrubia [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.
February 4, 2015

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 "

Thorsten Kiefer July 17, 2015

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