Hello! Im trying to make "Create button" ( Fragments+ behaviour fich (Scriptrunner)). I almost done it, but i have no idea how to automate autocomplete components value from context issue, help me to find error pls:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.bc.project.component.ProjectComponent
import static com.atlassian.jira.issue.IssueFieldConstants.*
def issueManager = ComponentAccessor.getIssueManager()
def projectManager = ComponentAccessor.getProjectManager()
def issue = underlyingIssue
if (getBehaviourContextId() in [
"create-issue-products"]) {
def contextIssue = issueManager.getIssueObject(getContextIssueId())
getFieldById("summary").setFormValue("Created from ${contextIssue.key}")
def links = ["${contextIssue.key}"]
getFieldById("issuelinks-issues").setFormValue(links)
getFieldById("issuelinks-linktype").setFormValue("blocks")
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def linkedEpic = contextIssue.getCustomFieldValue(epicLinkCf) as Issue
if(linkedEpic){
getFieldByName("Epic Link").setFormValue(linkedEpic.key)
}
def rodZad = getFieldById("customField_10501").setFormValue(links)
//component script part
def Componentss = contextIssue.getComponents()
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
getFieldById(COMPONENTS).setFormValue(components.findAll { it.name in Componentss }*.id)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.