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,361,803
Community Members
 
Community Events
168
Community Groups

Why my script doesn't work with Issue type ?

import com.atlassian.jira.component.ComponentAccessor

def issueType = issue.getIssueType().getName()

def array_issue_type = ["issue_type1","issue_type2","issue_type3","issue_type4"] as String

for(arr in array_issue_type) {

if (issueType == arr){

def userManager = ComponentAccessor.getUserManager()

def watcherManager = ComponentAccessor.getWatcherManager()

def watcher = ["username"]

watcher.each{userName->

def user=ComponentAccessor. userManager.getUserByName(userName)

watcherManager.startWatching(user, issue)

}
}
}

1 answer

1 accepted

4 votes
Answer accepted

You're declaring an array but immediately casting it into String, so the for loop never executes.

Hi! @Radek Dostál Yes exactly! thank you very much

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

An unofficial way to monitor a JSM mail handler for errors

...eturns true if any content is returned for the webResponse.body.data.first s...

718 views 3 20
Read article

Atlassian Community Events