Auto add subtask assignees as watchers of parent issue?

When we create a subtask for any issue, we would like to automatically add the assignee of that subtask as a watcher on the parent issue. We have ScriptRunner, JJUPIN, etc installed but I can't find a specific post-function script for what we want.

3 answers

1 accepted

This widget could not be displayed.

Hi Moriah,

Try adding the following SIL script post-function on the create issue transition:

if(isNotNull(parent)) {

%parent%.watchers = addElementIfNotExist(%parent%.watchers, assignee);

}

Make sure that you put the SIL post-function last in the list of post-fuctions for the create issue transition, after the issue is created.

Kind Regards,

Alex

Hi,

Did the provided SIL script helped you?

Sorry, I haven't had a chance to try it yet. I am knee deep in transitioning a team but will definitely try this out over the weekend. Thank you for the quick response!

Hi Moriah,

If the SIL script worked for you, please consider marking the answer as accepted.

Thanks,

Alex

Sorry it took so long to try it. I actually couldn't get it to work. I copied your exact script, added it to the workflow and placed it last in the list of post-functions. (I also tried it in different positions on that list too.) The post function list includes:

Creates the issue originally.

— THEN
Fire a Issue Created event that can be processed by the listeners.
— THEN
Assign the issue to the lead developer.
— THEN
This will run the Add sub assignees as parent watchers SIL program
The file of your program is stored as: /var/atlassian/application-data/jira/silprograms/Addsubassigneesasparentwatchers_1.sil
Start your programs with code comments, this way it will show here (max 3 lines)

Did you publish the workflow after adding the SIL post-function?

Is there any error in the log when creating a sub-task?

Argh. I was making changes to a workflow that was not associated with the project. Sorry, it DOES work :)

Thank you for your patience!

Yes, I published it. There were no log errors.

This widget could not be displayed.

There is no post-function to be found for such a specific action.

You have to write your own post-function as a "groovy" or "java plugin" [1].

best regards,

Marc

1 : since you are already using scriptrunner, i would go with a groovy script.

This widget could not be displayed.

Hi Moriah

I just added that postfunction to this plugin:

https://marketplace.atlassian.com/plugins/pt.lt.lfcribeiro.jira.jqlLTFunctions

Thx,

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 7 hours ago in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

24 views 1 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you