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!
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.