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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moriah,
If the SIL script worked for you, please consider marking the answer as accepted.
Thanks,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Start your programs with code comments, this way it will show here (max 3 lines)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you publish the workflow after adding the SIL post-function?
Is there any error in the log when creating a sub-task?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Argh. I was making changes to a workflow that was not associated with the project. Sorry, it DOES work :)
Thank you for your patience!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I published it. There were no log errors.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alexandru_Iacob could the same script be modified to add watchers from multiple fields in the parent ticket to the watchers list in the sub-task?
Our instance has a few fields (Project PM, Vendor PM, Developer PM, etc) that contain people that would like to be watchers on any sub-task creation.
I've already tried using the copy post function, but it overwrites the values, and only the last copy remains as watchers in the sub-task.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Moriah
I just added that postfunction to this plugin:
https://marketplace.atlassian.com/plugins/pt.lt.lfcribeiro.jira.jqlLTFunctions
Thx,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.