Forums

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

Field Required Validator Condition

Spruha Shah June 26, 2023

Hi, 

I want to make this field required through workflow validator, but i want to target it for only specific projects and issue types within those projects. 

What would be the best way to do this? Also, if i want to add a condition within that field required validator to only target specific project and issue type then what would be the query for it. 

I have done this in one another project and it works fine but it works for that project is because the issue type is associated with its own workflow and i only had to write the condition to target the project which i was able to do, but for my other projects 4 issue types are using this one workflow which is shared with many projects so i am having a hard time trying to figure out the condition for it.

 

1 answer

0 votes
Florian Bonniec
Community Champion
June 26, 2023

Hi @Spruha Shah 

 

When possible it's easier to use a dedicated workflow for your project and issue type instead adding complexity in the current workflow using conditions.

If you want to use condition you should be able to use something like that:

return (issue.get("issuetype").getName() == "XXX" && issue.get("project").getKey() == "YYYY")

Regards

Spruha Shah June 26, 2023

Thank you for your response. 

 

How would i write this condition if i was mentioning multiple projects or issue types? 

would it be this:

return (issue.get("issuetype").getName() == "XXX","YYY" && issue.get("project").getKey() == "YYYY","XXXX")

 

if you can look at how i added "YYYY" in first line and "XXXX" in second line.

Florian Bonniec
Community Champion
June 27, 2023

You can try

 

return (issue.get("issuetype").getName() in ["XXX","YYY"] && issue.get("project").getKey() in ["YYYY","XXXX"])

 

Regards

Suggest an answer

Log in or Sign up to answer