Workflow validator: Make field mandatory based on security level


We have two security levels which requires the user to set an assignee and unassigned is not allowed. I then tried to add the following script into a validator in the "Create" transition.

if(issue.getSecurityLevelId() == 10305 || issue.getSecurityLevelId() == 10308)
    issue.assignee != null

However, now the create dialogue wants an assignee for every security level. It seems like it ignores my if-check.

Can somebody help me on this?

Thanks and best regards


1 answer

1 accepted

Solved it with this condition:

((issue.getSecurityLevelId() == 10305 || issue.getSecurityLevelId() == 10308) && issue.assignee != null) || (issue.getSecurityLevelId() != 10305 && issue.getSecurityLevelId() != 10308)

However, can't I use if-checks the way I did in my first post?

try using

if (issue.getSecurityLevelId() == 10305L || issue.getSecurityLevelId() == 10308L) {
    return issue.assignee != null
return true

Oh, I see smile Thanks that works as well. I guess the letter L after the security level ID is a mistype? I removed it and it worked either way.

Oh, okay. Didn't know that but I'll keep this in mind. thanks again

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

850 views 2 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you