Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Behaviour, autocomplete system field Components

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)
    
    
   
}
Снимок экрана 2021-12-09 в 15.43.26.pngСнимок экрана 2021-12-09 в 15.49.06.png

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you