Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add a Reporter of main ticket as watcher for all new sub-tasks.

Sam
Contributor
August 20, 2018

Hi,

How can I set a rule to add Reporter of main task as a watcher for sub-tasks?

1 answer

1 accepted

0 votes
Answer accepted
Sam
Contributor
August 20, 2018

I used the workflow post function on sub-task creation:

The field Watchers will take the value from Reporter. Source issue is the parent, destination the sub-task.

I hope will work as expected.

Mohamed Adel
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 20, 2018

Hi Sam,

the following code will do the required task, every time a sub-task created

add the following script a custom post function script @ issue creation

import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger

def watcherManager = ComponentAccessor.getWatcherManager()
def user = issue.getParentObject().getReporter()

if (issue.getParentObject() != null){
watcherManager.startWatching(user,issue)
}

log.error(issue)
log.error(user)

 Note: Your post function must be last in the list to the 

 

Thanks 

Muhammet Adel 

Suggest an answer

Log in or Sign up to answer