Behaviours Plugin - Making a field mandatory depending on other data entered in to the form

I have a custom field in Jira and it is a drop down (Yes, No)

Now based upon the answer of this custom field, if Yes, then make another custom field (text unlimited) required.

custom field - Fiance Change (Yes, No)

custom field - Finance Approval (free form text field unlimited)

How do I make the Finance Approval custom field required if the drop down value of Finance Change is set to Yes?

I don't have any scripting knowledge and I don't see an easy way to create this behaviour.

1 answer

Add this script to the finance change field, apply behaviour to project:

def finCf = getFieldByName("Finance Change")
def appCf = getFieldByName("Finance Approval")

appCf.setRequired(finCf.getValue() == "Yes")

Hi Jamie,

The mandatory field in my side is JIRA System field "Linked Issues", I tried your script but it doesn't work, do you have any idea? Thanks

def A = getFieldByName("Root Cause")
def B = getFieldByName("Linked Issues")
B.setRequired(A.getValue() == "Caused by Defect Fix")


I have the same issue!!, please help

Hi Jamie - I'm using the solution you provided above, BUT I'm seeing something that I'm assuming is a bug. All initially seems to work fine except when I delete the contents of the field that's required it makes the field required when it shouldn't be (See Use Case below).

I'm hoping you have a solution on how to workaround it.


I have these two custom fields created...

  1. Issue Blocked (A Select List field with Yes/No values)
  2. Reason Blocked (A Text Field)

The following script is associated with the Issue Blocked field...

def blockedCf = getFieldByName("Issue Blocked")
def reasonCf = getFieldByName("Reason Blocked") 

reasonCf.setRequired(blockedCf.getValue() == "Yes")

Steps to reproduce the issue:

  1. Load the Issue Create screen (or Edit screen).
  2. Outcome: The "Issue Blocked" field is set to "None" by default and the "Reason Blocked" field is NOT required (which is correct).
  3. Set the "Issue Blocked" field to "Yes".
  4. Outcome: The "Reason Blocked" field is now required (which is correct).
  5. Input some text into the "Reason Blocked" field.
  6. Outcome: The "Reason Blocked" field remains required (which is correct).
  7. Set the "Issue Blocked" field to "No" (or "None").
  8. Outcome: The "Reason Blocked" field is no longer required (which is correct).
  9. Delete all of the text that was entered into the "Reason Blocked" field.
  10. Outcome: The "Reason Blocked" field is now required (which is NOT correct.... because the "Issue Blocked" field is still set to "No".
Has this issue been reported before? Do you know of a workaround?
Thanks in advance!

I entered JBHV-294 for this issue. It contains screenshots for further clarification on the behavior I'm seeing. Cheers!

OK, I'll have a look... cheers for the issue, the screenshot is very clear.

Perfect! Hope to hear from you soon. ...thanks again Jamie!

Along the lines of the original request....I need to do the following: system field - fixVersion custom field - Detected in Version (single version picker) custom field - Reason for Deferral (multi-select list) How do I mandate Reason for Deferral custom field if fixVersion does not match Detected in Version? Null value should be excluded from the mandate.

Does something need to be different if the cf is a scripted field? I am using following, where "Version Control" is a scripted CF that can contain "Deferred" or "In Scope" as values...this doesn't do anything. def versionCf = getFieldByName("Version Control") def reasonCf = getFieldByName("Reason for Deferral") reasonCf.setRequired(versionCf.getValue() == "Deferred")

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


275 views 0 7
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