Check if the asignee is currently asigned to a specific user

Hi! I wanted to allow a transition if the assignee is equal to username lsc.pa or if issue.assignee != originalIssue.assignee.

Can anyone help me to achieve this goal? I wanted to implement this as a validator. I am currently using Jira version 6.2.

3 answers

Try:

issue.assigneeId != originalIssue.assigneeId

or

issue.assignee.getName() == 'myusername'

how can I implement an OR statement in validator?

(issue.assigneeId != originalIssue.assigneeId)  ||(issue.assignee.getName() == 'myusername')

Thanks Boris, I modified the operator since my condition should be '&&'.

Hi Alvin,

here your code :

import com.atlassian.jira.issue.Issue;
		
Issue issue = issue;
if(issue.getAssigneeUser().getName().equalsIgnoreCase("username")){
	return true;
}
return false;

What is original issue? A linked issue a specific one? Let me know so that I can provide u the whole code.

Hope this helps,

Fabio

Oh I forgot to answer your question, I am not sure but what I know is that originalIssue in this context 'originalIssue.assigneeId' is an object.

Hi Fabio,

I apprecate a lot for the efforts you extend in helping me on this. The code seems to work as a Script validator in my jira project I am working on. However upon testing the code it does not work as I expected. I don't know if I am missing an import or something is missing in the code.

What I did is that I use the code you provided above provided by Boris:

(issue.assigneeId != originalIssue.assigneeId)  ||(issue.assignee.getName() == 'myusername')

and instead I use the '&&' operator to achieve my goal. I use it as a simple script validator now and it works greatly!

The working code I got based from Boris' answer is below.

issue.assigneeId != originalIssue.assigneeId && issue.assignee.getName() == 'lsc.pa'

Again, thank you so much Boris!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,203 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot