It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Check if the asignee is currently asigned to a specific user

Alvin Gasta Apr 23, 2014

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

2 votes
Boris Georgiev Apr 23, 2014

Try:

issue.assigneeId != originalIssue.assigneeId

or

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

Alvin Gasta Apr 23, 2014

how can I implement an OR statement in validator?

Boris Georgiev Apr 23, 2014
(issue.assigneeId != originalIssue.assigneeId)  ||(issue.assignee.getName() == 'myusername')

Alvin Gasta Apr 24, 2014

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

0 votes
Fabio Racobaldo [Herzum] Community Leader Apr 23, 2014

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

Alvin Gasta Apr 24, 2014

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.

Alvin Gasta Apr 24, 2014

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!

0 votes
Alvin Gasta Apr 24, 2014

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 Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

777 views 0 12
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you