Through groovy script on an issue, how to write code to set assignees for the subtasks of the issue? I tried getting the subtask objects and iterating through each one of them and setting the assignee id, but i get the error that '"cannot set read-only property: AssigneeId". How should I go about this?
Issue class is just represents issue. All methods to modify it are into MutableIssue. Issue.getSubTaskObjects() return collection of Issue objects. Since it is requered to transform it into MutableIssue ones. I usually do it like this:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.MutableIssue MutableIssue mutableIssue; IssueManager issueManager = ComponentAccessor.getIssueManager(); for(Issue subtask: issue.getSubTaskObjects()){ mutableIssue = issueManager.getIssueObject(subtask.getId()) mutableIssue.setAssigneeId("") // }
@Vasiliy Zverev but this doesnt change the assignee id of the subtask issue. It just sets it for the mutable issue object we created. right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay I just ran an updateissue() and it worked! Thanks a lot!!!!
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.