Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,018
Community Members
 
Community Events
168
Community Groups

How to send the notification to an specific email address using a script listener (cloud)

Hi, 

I am trying to configure a script listener to send a notification when there is a change in a custom field. I found an example in the script runner doc and it looks pretty straightforward but there is not mention about the syntax when the receiver of the email is an specific email address. Below is an excerpt of the listener where the email is sent to reporter, assignee, watchers, voters, the admin user and member of the jira-administrators group but I am not sure what is the syntax when the recipient is an specific email address, such as example@mydomain.com. Can you please help?

 

Thank you

 

to: [ reporter: issue.fields.reporter != null,

        assignee: issue.fields.assignee != null,

         watchers: true,

          voters: true,

          users: [[ name: 'admin' ]],

          groups: [[ name: 'jira-administrators' ]]

 

]

2 answers

1 accepted

0 votes
Answer accepted

Hi Tomas,

Thank you for your question.

I can confirm that the reason that you cannot notify an external email address is due to a limitation with the notify rest API which specifies that users are not allowed to notify their own user using the rest API.

I can confirm that as specified in the Rest API documentation page linked above that the API requires a list of Jira users or groups to be sent as paramaters and that you cannot pass a list of emails. 

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.

Regards,

Kristian

Hi Kristian...thank you for your answer. 

The email address is not my own email address so actually that comment "users are not allowed to notify their own user using the rest API" does not apply in what I want to accomplish here.

 

And then, if the only options are reporter, assignee, users, and so on, then how to accomplish something like this via a script listener in scriptrunner for cloud? To notify a specific email address via a script listener

 

Thank you for your assistance

Hi  Tomas,

I apologize but my wording was not clear in my previous response and I meant to say that you can only notify Jira users or groups and cannot notify a specific email address as the notify API from Atlassian which ScriptRunner Jira Cloud uses does not support this. 

This means you would need to specify a user with the email address that you wish to notify.

Regards,

Kristian

Hi Kristian...got it...thank you. You mean kind of a "dummy user" with that email associated and just use the user name in the script listener instead of the actual email address?

Hi Tomas,

This is correct.

You would need to create a dummy user with the email address that you wish to send to configured as that users email address as then you can specify that user in your script in order to send the notification to that email address.

Regards,

Kristian

Got it...thank you so much Kristian!

Hi

Is this a custom email being sent? If so, could you please share your code?

 

Or is it a notification email with the format of all the other notifications?

 

Thank you in advance

Suggest an answer

Log in or Sign up to answer