I want to automatically create sub-tasks which I've found a ScriptRunner post function to do this but I want to set the assignee the same as the parents,
I've not been able to find examples for Jira Cloud ScriptRunner.
This works:
if (issue.fields.assignee != null) {logger.info("Setting assignee to ${issue.fields.assignee}")subtask.fields.assignee = issue.fields.assignee} else {logger.warn("Parent issue does not have an assignee: ${issue.fields}")}
If you already have a handle for the issue:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.event.type.EventDispatchOptionIssue subtaskIssue = //however you're getting the issue hereApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()IssueManager issueManager = ComponentAccessor.getIssueManager()Issue parentIssue = subtaskIssue.getParentObject()subtaskIssue.setAssignee(parentIssue.getAssigneeUser())issueManager.updateIssue(user, subtaskIssue, EventDispatchOption.ISSUE_UPDATED, false)
Granted, I'm more familiar with Server JIRA, so this might not work. Good luck.
Yes, the imports in Jira Cloud do not work, I get :-
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 2: unable to resolve class com.atlassian.jira.issue.Issue @ line 2, column 1. import com.atlassian.jira.issue.Issue ^
Sorry to hear that, best of luck figuring it out
Thanks
In cloud how will make?
Thank's
I think that you need this
https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest%2F&utm_medium=302#api-api-3-issue-issueIdOrKey-assignee-put
It looks like you're new here. Sign in or register to get started.