There are often cases where you want a listener to send a custom email to a group of people and the watcher/s of the issue to be member/s of this group. What will often happen (depends on your notification scheme) is that the watcher/s will get two emails for the same thing (one JIRA notification email and one from the listener).

The script below makes use of the Condition and Configuration section to solve the problem.

import com.atlassian.jira.component.ComponentAccessor

def locale = ComponentAccessor.getLocaleManager().getLocaleFor(currentUser)
def watchers = ComponentAccessor.getWatcherManager().getWatchers(issue, locale)

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Multi User Picker CF")

//get the users' email addresses, in a comma separated string, that are members of the Multi User Picker custom field and are not watchers
def recipients = issue.getCustomFieldValue(cf)?.findAll {! watchers.contains(it)}?.collect {it.emailAddress}?.join(",")

mail.setTo(recipients)

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.