Here the sample code to add a fixed watcher on the create issue transition of a Workflow. Very easy and useful script! This is a script PostFunction of the Adaptavist Groovy ScriptRunner Atlassian JIRA Plugin.
You can add, for example, a user linked to an email of a distribution list.
import com.atlassian.jira.issue.watchers.WatcherManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField cf_type= customFieldManager.getCustomFieldObject("customfield_XXXX") //Typical select combo field
def type= issue.getCustomFieldValue(cf_type)
if ( "${type}"== 'SOME VALUE OF THE SELECT COMBO FIELD') {
def userManager = ComponentAccessor.getUserManager()
WatcherManager watcherManager = ComponentAccessor.getWatcherManager()
watcherManager.startWatching(userManager.getUserByName("user_linked_to_a_distribution_email_list_for_example"), issue)
}





