The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
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!

DEPLOYMENT TYPE
SERVER
VERSION
8.5.4
TAGS
AUG Leaders

Atlassian Community Events