There are two custom fields on my screen.
1. associated parent issue(drop down).
2.Associated parent issue summary.
so now there are some issues in associated parent issue type drop down box. When I select any issue from drop down the summary of that selected issue should be displayed in the Associated parent issue summary field.
Create a scriptrunner behaviour mapped to your project/issuetype.
Add your issue picker field to the configuration.
Then add a server-side script:
import com.atlassian.jira.component.ComponentAccessor
def issuePickerFld = getFieldById(fieldChanged)
def issueSummaryFld = getFieldByName("Parent Issue Summary") // <-- adjust for the correct field name
def parentIssueKey = issueSummaryFld.value
if(parentIssueKey){
def parentIssue = ComponentAccesso.rissueManager.getIssueObject(parentIssueKey)
issueSummaryField.setFormValue(parentIssue.summary).setReadOnly(true)
} else {
issueSummaryField.setFormValue("").setReadOnly(false)
}
Hi thanks for your code
I have tried to run this code but its showing error on line
def parentIssue = ComponentAccessor.issueManager.getIssueObject(parentIssueKey)
issueSummaryFld.setFormValue(parentIssue.summary).setReadOnly(true)
on these two lines. Do I have to write a parent issue key id here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My apologies, I had a few errors in the code. But also, not all static type-checking errors are bad. Sometimes they can be ignored.
Try this:
import com.atlassian.jira.component.ComponentAccessor
def issuePickerFld = getFieldById(fieldChanged)
def issueSummaryFld = getFieldByName("Parent Issue Summary") // <-- adjust for the correct field name
def parentIssueKey = issuePickerFld.value as String
if(parentIssueKey){
def parentIssue = ComponentAccessor.issueManager.getIssueObject(parentIssueKey)
issueSummaryFld .setFormValue(parentIssue.summary).setReadOnly(true)
} else {
issueSummaryFld .setFormValue("").setReadOnly(false)
}
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.