Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to make linked issues field mandatory for specific conditions and project - JMWE

subham_p
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 9, 2023

Hi there, 

I am trying to get the following scenario to work. 

  • If customfield_1234 = "XYZ" then Linked Issue is required
  • at the same time linked issues should only allow issues from the ABC project

I am trying out the below validators. However, the #2 validation is blocking the transition when some other values are selected in the custom fields. 

  1. Fields Required Validator - Linked Issue mandatory with condition customfield_1234 = "XYZ"
  2. Scripted (Groovy) Validator -  with the following script
import com.atlassian.jira.component.ComponentAccessor
import webwork.action.ActionContext
 
def fieldManager = ComponentAccessor.fieldManager
def issueManager = ComponentAccessor.issueManager
def linksSystemField = fieldManager.getField("issuelinks")

def request = ActionContext.request
def params = request.parameterMap
def issueLinkingValue = linksSystemField.getRelevantParams(params)

def linkedIssues = issueLinkingValue.linkedIssues
def linkedIssueProjects = linkedIssues.collect { issueManager.getIssueObject(it).projectObject.key }

linkedIssueProjects == ["ABC"]

 

0 answers

Suggest an answer

Log in or Sign up to answer