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

1 vote
Accepted answer

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
Community showcase
Published Feb 07, 2019 in Marketplace Apps

A Timeless Love Story

It started as any story starts, on a normal, rainy day.   Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...

458 views 8 27
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