With the following in the additional issue actions the subtask is just being assigned to me and not the default assignee for the component.
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.project.Project
import com.atlassian.jira.bc.project.component.ProjectComponent
MutableIssue issue = issue
//parent = issue.getParentObject()
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
//Get valuje of user picker custom field
CustomField customField = customFieldManager.getCustomFieldObjectByName("Name")
customFieldValue = issue.getCustomFieldValue(customField)
//set components
Project project = issue.getProjectObject()
ProjectComponent component = componentManager.getProjectComponentManager().findByComponentName(project.getId(), "Laptop Provisioning")
issue.setComponents([component.getGenericValue()])
String prefix = customFieldValue
println customFieldValue
println prefix
issue.summary = prefix + ' - Provision Laptop'
Is the parent assigned to you? It defaults to taking all values from the parent IIRC. If you want it to take the value of the first component lead you need to do that yourself.
Not tested but something like:
def components = issue.componentObjects if (components) { issue.assigneeId = components.first().lead }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it is assigned to me. Would you be able to give me the code that I can use to set the assignee to the component lead?
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.
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.