Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,529
Community Members
 
Community Events
184
Community Groups

Make a field required based on a selection in another field

A question was posed to me from a user who would like to set up something where when a check box is made within a screen's fields, that another field becomes mandatory. Is this possible?

1 answer

0 votes
Manoj Kumar
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.
May 26, 2023

Hi @Matthew Knab ,

 

For that, you need to use a Field Required (JMWE app) Validator, select the required field, and add a "Conditional Validation" script like:

issue.customfield_12345.value == "Regression"

where customfield_12345 is the custom field ID of field Source. This easiest way to insert the right field ID is to use the "Issue Fields" help tab below the editor.

OR

If you have scriptrunner then you can add a behavior like this.

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def regressionIssueField = getFieldById(getFieldChanged())
def regressedVersionField = getFieldByName("Regressed from Version")

String regressionIssueValue = regressionIssueField.getValue()

if (regressionIssueValue == "Yes") {
    regressedVersionField.setRequired(true)
} else {
    regressedVersionField.setRequired(false)
}

Thanks Manoj! Where would be the best spot to set this up, in the workflow or somewhere else?

Manoj Kumar
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.
May 26, 2023

The Field Required (JMWE app) Validator, you can use in your workflow.

 

For 2nd option, You have scriptrunner then go to the manage apps>>ScriptRunner>>Behavior>>Create a new behavior>> Create a mapping for the project and paste the script under initializer.  

And this would be setup as a Validator correct? I'm trying to find the best transition to attach it to. So far, I have tried to set it to a creation transition for a ticket, but it didn't seem to work.

Suggest an answer

Log in or Sign up to answer