I use scriptrunner to create a set of sub-tasks when the status of the parent issue is changed, and I would like to assign the sub-task to the user who is specified in a user-picker field in the parent issue.
Is there a way to do this? any suggestion would be helpful.
Let me know if the question is not clear.
Thank you in advance.
Jun
There are a few examples below the 'Additional issue actions', which led me to doing this:
import com.atlassian.jira.user.ApplicationUser
def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Single User Picker CF Name'}
if (cf && sourceIssue.getCustomFieldValue(cf)) {
issue.setAssignee(sourceIssue.getCustomFieldValue(cf) as ApplicationUser)
}
If you're creating those subtasks all within Groovy without using the 'Create a sub-task' postfunction then that would be pretty similar process except that you would do IssueInputParameters.setAssignee() before validation/creating, but that's probably not the case I assume.
Thank you so much for your help again.
The script worked perfectly, it picks the value of the field from the current parent issue, which is exactly I wanted.
I wasn't sure what "If you're creating those subtasks all within Groovy without using the 'Create a sub-task' postfunction" means, creating the subtasks using the other way?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@teisyun I meant that I assumed you were using the 'Create a sub-task' postfunction which is out of box from ScriptRunner, and that one contains the 'Additinal issue actions' box, rather than creating the subtask in your own custom code or some other implementation. In any case glad that you've found it and that it worked :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see, thank you for your quick reply, and Yes, it worked for me!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.