Forums

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

Mandatory field condition as per value

Ana Luiza Chagas
Contributor
May 21, 2025

Hi everyone,

I would like to know if it is possible to develop a condition within Scriptrunner for Jira Cloud that checks the following:

- It would be implemented in the create -> backlog workflow
- If field A is selected with "yes" in the single list, field B becomes mandatory
- The flow works normally if the "no" option is selected in the single list
- The flow also works normally if "yes" is selected and field B is filled

Has anyone seen something similar and could help me, please?

Thanks!

3 answers

Suggest an answer

Log in or Sign up to answer
2 votes
Kristian Walker _Adaptavist_
Community Champion
May 22, 2025

Hi Ana,

I can confirm that if you are using ScriptRunner for Jira Cloud, then you can achieve this use case using the Behaviours feature.

You can see what fields and methods Behaviours supports inside the documentation page located here.

Also, we have an example of how to make fields required based on a value in a select list field here or here that you can use as an example to help create the script that you require.

I hope this information helps.

Regards,

Kristian

0 votes
Maciej Dudziak _Forgappify_
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 22, 2025

Hi @Ana Luiza Chagas

If you are open to use apps, you may want to look at the app my team developed - Field Rules – UI Modifications for Jira. It includes a Make field required rule, which allows you to make a field required dynamically based on selection in other fields. It is configured via UI, no coding needed.

The rule comes with extensive precondition settings, including user groups, project roles, and the state of other fields.

I hope it will help

Cheers

0 votes
Gor Greyan
Contributor
May 21, 2025

Hi @Ana Luiza Chagas ,

def fieldA = issue.fields.customfield_XXXXX // Replace with Field A ID
def fieldB = issue.fields.customfield_YYYYY // Replace with Field B ID

// Logic: if Field A is "Yes", then Field B must be filled
return !(fieldA == "Yes" && (fieldB == null || fieldB.trim() == ""))

Try the following script in the workflow, on the needed transition setting the validation.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events