make field mandatory for a particular issueType

I expected this code to make the field mandatory for "Issue Type" = QA or when "Task Type" field is "analysis" or Code Review" for rest of issue types.


Its is working for the change in "Task Type" field values, but not working for "Issue Type" = "QA"

What am I doing wrong?



def selectCFValue = getFieldByName("Task Type").getValue()
def targetField = getFieldByName("SVN Path")
def issueType = getFieldByName("issuetype-field").getValue()
if (issueType == "QA")
if (selectCFValue == "Analysis" || selectCFValue == "Code Review")

2 answers

0 votes

Issue type is not a field (so line 3 is wrong) and when you fetch the object, a simple comparison to a string is never going to work.


if ( "QA".equals (issue.getIssueTypeObject.getName()) )


0 votes
Joseph Pitt Community Champion Jul 05, 2017

Why not use a field configuration for that issue type and make it mandatory there? that is built in and no code is required.

Ok, so you are suggseting making a duplicate field configuration for QA task as its now using a shared configuration with other issue tupes that do not need this field as required?

I guess I can do that

Joseph Pitt Community Champion Jul 05, 2017

Yes. That is the beauty of the field configuration scheme. You can create different field configurations for each issue type if desired and create the field configuration scheme from them. It is th configuration scheme, not an individual configuration that is tied to the project. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,241 views 5 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you