Forums

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

How to make Fix Version required depending on Custom field value

Luis Tellado September 22, 2020

Looking for a simple ScriptRunner Behaviour to make this happen on issue creation. It seems that I'm getting closer, but it's not working. The custom field name is "Request Type" and if the value is "Release Related" it should make the Fix Version field required. 

def field1 = getFieldByName("Fix Version/s")
def field2 = getFieldById("customfield_13590")
if(field2.getValue().equals("15121"))
{ field1.setRequired(true) }
else { field1.setRequired(false) }

1 answer

1 accepted

0 votes
Answer accepted
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 22, 2020

Hi @Luis Tellado ,

Give it a try with def field1 = getFieldById("fixVersions")

BTW what is the field type of customfield_13590?

Luis Tellado September 22, 2020

@Niranjan ,

It did not work and that is the field id for "Release Related"

Using your suggestion, this works!

def field1 = getFieldById("fixVersions")
def field2 = getFieldByName("Request Type")
if(field2.getValue().equals("Release Related"))
{ field1.setRequired(true) }
else { field1.setRequired(false) } 

THANK YOU!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events