Hi,
In transition screen Close Abort, I want to show only the linktype 'duplicates' when a certain option 'Duplicate' (ID 10220) is chosen in a radio button custom field 'Abort Why'.
I tried this script behaviour both on the Linked Issues field and the Abort Why field, but it doesn't work. Only the hiding works, but not the radio button option condition.
I used both ID 10220 and Duplicate.
Any ideas?
Hi Sabine,
Kindly check the below behaviour. Minor modifications may be required as I haven't tested it on my system but I believe it should work. Please mark the answer as accepted if it works for you.
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def issueLinkType = getFieldById("issuelinks-linktype")
def allowedTypes = ["approves"]
def abortwhy= getFieldById("customfield_10111")
def abortwhyValue = abortwhy.formValue.toString()
def screenName = "Close Abort"
IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
Map outwardAllowedLinks = issueLinkTypeManager.getIssueLinkTypes(false).findAll{ it.outward in allowedTypes }.collectEntries{
[it.outward,it.outward]
}
def allowedLinks = outwardAllowedLinks
if (abortwhyValue == "Duplicate" && actionName == screenName) {
{
issueLinkType.setFieldOptions(allowedLinks)
}
Thanks,
Aditya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.