Forums

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

Required JMWE Validator doesn't work for new Parent field

Lori Milam
Contributor
January 26, 2024

I'm trying to require the new Parent field on the Create screen only for bugs and stories. I'm using JMWE on the Create transition. My JQL condition is:

(!!issue.issueType && issue.issueType.name == "Bug") || (!!issue.issueType && issue.issueType.name == "Story")

Whether you put a value in the Parent field or not you get the validation message that Parent is required. I thought I had this working like this last week and now it doesn't work. I've looked through the logs and no errors or anything is being reported.

The Story issue type shares a screen with other issue types so I can't just make the Parent field required in the field config.

Is there a problem with this new Parent field not working with JMWE? Am I just missing something and I don't have the condition right?

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
January 26, 2024

Hi @Lori Milam 

First of all, your conditional validation script is not JQL but a Jira Expression. 

In any case, I believe the reason the validator stopped working is because Atlassian released a major change to Jira around issue hierarchies. 

Can you try using a Build-your-own validator with this expression:

issue.issueType.name != "Bug" && issue.issueType.name != "Story || !!issue.fields.parent
Lori Milam
Contributor
January 29, 2024

Here is my Build-your-own validator and it still acts the same way

Capture.PNG

David Fischer
Community Champion
January 29, 2024

Hi @Lori Milam 

The expression I provided is meant to be the full Jira expression, with no conditional validation. 

Lori Milam
Contributor
January 29, 2024

Using your expression throws an error on issue.fields.parent . I changed this to issue.parent to get past the error and it still acts the same, throwing the validation error even when a parent is selected.

David Fischer
Community Champion
January 29, 2024

Hi @Lori Milam 

my apologies, I made a mistake. The correct Jira expression would be:

issue.issueType.name != "Bug" && issue.issueType.name != "Story || !!issue.parent

(I confused Jira expressions and Nunjucks)

However, the documentation for Jira Expressions clearly states that "During issue creation, only available in workflow validators for subtasks in company-managed projects." This means that, at least for now, you cannot use a Validator to enforce a parent issue except for sub-tasks, and you cannot check anything on the parent issue either. This is a Jira Cloud limitation; you should contact Atlassian support to complain about it.

Lori Milam
Contributor
January 29, 2024

Thank you @David Fischer that would answer my question why this isn't working. And since I can't find a way to make a standard field required in the field configuration (unless you know) I guess I can't fulfill this request. I definitely will be entering a ticket for this.

0 votes
Benjamin
Community Champion
January 26, 2024

Welcome @Lori Milam !

 

Probably simpler to write the JQL like so:

 

issuetype in (bug, story)

 

Hopefully this works for you. 

Lori Milam
Contributor
January 26, 2024

That works too, but what I believe is really the problem is not recognizing that there is a value in the Parent field. This part of the JQL works fine.

Benjamin
Community Champion
January 26, 2024

HI @Lori Milam ,

 

Great. Possibly there could be an issue with JMWE. Maybe it would be good to share the screenshot of the configuration to see where the configuration might be an issue. 

If indeed a bug, a short term workaround is to just make the field required in the field configuration and tied that field configuration to bug and story issue type. Although, It will be applied throughout the workflow and screens and not just the create screen and transition. 

 

Hope this helps

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