Is there possibility to add specific users (or group of users) as an watcher if Jira SD receives ticket where issue security level is set as "Dangerous"?
So kind of scriptrunner listener, where script adds watcher when "Dangerous" issue is created?
I generally try to stay away from manipulating watchers. Users won't understand why they are watching issues which they've not interacted with or added themselves as watcher.
You could use a custom listener "send a custom email" instead. You could either just watch issue create event and check for securityLevel == 'Dangerous', or issue updated event and check for a change in security level from anything to 'Dangerous'.
import com.atlassian.jira.component.ComponentAccessordef islm = ComponentAccessor.issueSecurityLevelManagerdef level = islm.getSecurityLEvelByName('Dangerous')if(event.eventTypeId ==1) { //for create event return event.issue.securityLevelId == level.id} else { return event.issue.securityLevelId == level.id && changeItems.any{it.field == 'Security')}}
This sounds more logical. It's better to get custom email than mysterious watcher notification. Have to setup this in our test site soon.
Sorry to inform, but this code throws few errors.
Last line show only ) character, no ( and if I add it before 'Security', more errors is raised.
My coding skills are bad to begin with and I just can't get this to work.
Remove the ) ... It's not needed. Probably just a typo on my part.
It looks like you're new here. Sign in or register to get started.