Currently improving out Incident Workflow and we are over zealous on our alerts so we do get duplicate issues sometimes.
To simplify the workflow, from the 1st New status to the Last Closed status we are implementing a 'Duplicate' transition. This automatically sets the resolution to 'Duplicate' and presents a screen for adding linked issues.
The Linked issue filed currently shows all Linked description, it would be ideal if we could ensure that only 'the 'Duplicates' description is pre-selected and the only option on that screen.
Also need to ensure that a valid issue has been specified.
Added the following behavior on a 'Duplicate' Transition
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkTypeManager
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)
FormField linkTypes = getFieldById("issuelinks-linktype")
def allowedOutwardTypes = ["Duplicates"]
def allowedInwardTypes = []
IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
Map outwardAllowedLinks = issueLinkTypeManager.getIssueLinkTypes(false).findAll{ it.outward in allowedOutwardTypes }.collectEntries{
[it.outward,it.outward]
}
Map inwardAllowedLinks = issueLinkTypeManager.getIssueLinkTypes(false).findAll{ it.inward in allowedInwardTypes }.collectEntries{
[it.inward,it.inward]
}
def allowedLinks = outwardAllowedLinks << inwardAllowedLinks
log.debug("Allowed Links = $allowedLinks")
linkTypes.setFieldOptions(allowedLinks)
is it available only with "Script Runner"?
where should I add this script, in the script runner validators ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You would need to add this as a behavior for the required workflow transition.
Behaviours are configured within the Script Runner configuration screens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Out of the box this functionality is not available. you will have to use a script plugin such as power scripts or scriptrunner to limit the issue link options in the transition screen.
Another option is to use extended schemes: https://marketplace.atlassian.com/apps/1214172/extended-schemes-for-jira?hosting=server&tab=overview
But this would restrict at the issue type level so that limited options will show per issue type resolutions.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Scriptrunner scripts would be the best option :-)
Just trying to work out the best way to achieve it .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.