Hi Folks,
Please help to make my script work properly. I need to fill Affected Version's (system) filed via value Fix Version's from Context issue.
import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.atlassian.jira.issue.IssueFieldConstants.*
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUserdef issueManager = ComponentAccessor.getIssueManager()
def contextIssue = issueManager.getIssueObject(getContextIssueId())
def customFieldManager = ComponentAccessor.getCustomFieldManager()
if (getBehaviourContextId() == "link-create-blocking") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
getFieldById("issuelinks-linktype").setFormValue("Linked to Testing").setReadOnly(true)
getFieldById("fixVersions").setFormValue(contextIssue.versions).setReadOnly(true)
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def linkedEpic = contextIssue.getCustomFieldValue(epicLinkCf) as Issue
if (linkedEpic) {
getFieldByName("Epic Link").setFormValue(linkedEpic.key).setReadOnly(true)}
}
What i do wrong?
Solved:
getFieldById("versions").setFormValue(contextIssue.fixVersions*.id).setReadOnly(true)
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.