I’m setting up Jira for our bug tracking system. I’ve got custom screens for the ‘resolved’ and ‘closed’ steps in my workflow. Here’s my problem: I want to make certain fields required only in these specific screens, not in the create or edit screens.
I’ve tried playing with field configurations, but no luck. If I set a field as required, it becomes mandatory everywhere, even on screens where it shouldn’t be.
Has anyone figured out how to make fields required only on certain workflow screens without using plugins or messing with the code? I feel like I’ve tried everything!
workflow:
steps:
- name: Open
screen: default
- name: Resolved
screen: custom_resolved
- name: Closed
screen: custom_closed
field_config:
- name: Resolution
required: true // How to make this true only for Resolved and Closed screens?
Any ideas would be super helpful. Thanks!
I’ve dealt with this exact issue before, and it can be frustrating. Unfortunately, out-of-the-box Jira doesn’t offer a straightforward way to make fields mandatory only on specific workflow screens. However, I found a workaround that might help you.
Instead of using field configurations, try creating a custom field validator. You can set up a validator that checks the issue status and makes the field required only when the status matches your ‘Resolved’ or ‘Closed’ states. It’s not perfect, but it gets the job done without plugins or code changes.
To do this, go to Issues > Custom Fields > Select your field > Edit > Validators > Add validator. Choose ‘Regular expression’ and use a condition like:
if (issue.status.name == ‘Resolved’ || issue.status.name == ‘Closed’) && !issue.resolution {
return false;
}
This approach has worked well for my team. It requires a bit more setup, but it gives you the flexibility you need without compromising other screens or steps in your workflow.
hey there! i’ve run into this too. it’s a pain, right? sadly, jira doesn’t let u do this out of the box. but here’s a trick - use a scripted field! create a new custom field, set it as optional, then add some groovy code to make it required only on those screens. it’s not perfect, but it works. good luck!
While Jira doesn’t natively support field-level requirements for specific screens, there’s a clever workaround using Jira’s scripting capabilities. You can implement a post-function script in your workflow transitions to enforce field requirements.
For the ‘Resolve Issue’ and ‘Close Issue’ transitions, add a post-function using the Script Runner add-on (if available in your Jira instance). The script can check if the required fields are filled and prevent the transition if they’re not.
Here’s a basic pseudocode example:
if (issue.resolution == null || issue.customField == null) {
return ‘Please fill in all required fields before resolving/closing.’
}
This method allows you to keep your fields optional in other screens while enforcing requirements in specific workflow steps. It’s more flexible than global field configurations and doesn’t require custom development.