How to require a field for specific issue type?

Christopher Kim
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 21, 2024

Hi I have three sub-task issue types that share the same workflow and only one of the three requires a custom field.

I do not want to create a separate workflow but instead want to trigger a field requirement from the workflow they are sharing by using custom script.

issue.issueType.name == 'Storybug' && !issue.get("customfield_XXXXX")?.value   did not seem to work. What am i missing. Is it even possible to do this in the workflow?

4 answers

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2024

Hi Christopher,

You can simply create multiple transitions and add a condition for the separate issue types. Then in the one where it is required, add a Field Required validator. 

Matt Parks
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.
February 22, 2024

Even though I provided an answer, I'm voting for this one, as it's one that I use in multiple workflows. I'm not sure why my brain didn't go to the solution that I've already implemented, but....

 

I do think you need to have the JSU plugin for this.

0 votes
Teja(Appfire) February 22, 2024

Hi @Christopher Kim ,

You accomplish your requirement using the Jira Misc Workflow Extensions (JMWE) app, please follow these steps

  1. Add Field Required Validator(JMWE): For more details on adding this validator, please refer to the following link: https://appfire.atlassian.net/wiki/spaces/JMWEC/pages/465242701/Field+Required+Validator:

  2. You can add a condition validator with simple Jira Expression which validates if the issue type is "story bug".

  3. issue.issueType.name == "Storybug"
  4. Please see the screenshot below for reference.

Screenshot 2024-02-23 at 1.03.39 PM.png

Hope it helps!

Thanks,
Teja

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2024

Hi Christopher,

I can confirm in Jira Cloud you can use the Workflow validators feature provided by Scriptrunner for Jira Cloud.

Workflow validators use the Jira Expression framework provided by Atlassian, and you will need to use these to create the conditions you require.

I can confirm we have an example on line 76 here which shows how to allow a specific type of subtask to be created when a custom select list field has a value and this will help act as a guide to help create the expression that you require.

I hope this helps,

regards,

Kristian

 

0 votes
Matt Parks
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.
February 21, 2024

I'm not as familiar with Cloud, but in Data Center, if you have the Scriptrunner plugin, you can use the 'Field(s) required validator' on the transition and make the field required, but add in a condition that the issue in transition has to have a specific issue type.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events