How do you do an AND and a XOR in the same condition for a Fast Track Script Listener?

Hi

I am attempting to create a fast track script listener that will change the status of a job when the following conditions are met:

  • A particular client name is on the ticket (custom Field)
    AND
  • When the issue reporter name is either User 1 OR User 2 OR User 3 or User 4

I am struggling with this and have only managed to come up with the following:

(cfValues['Client']?.value == 'ClientName')&&((issue.reporter.name == ('User1')) xor (issue.reporter.name == ('User2')) xor (issue.reporter.name == ('User3')) xor (issue.reporter.name ==  ('User4')))

 

Every single time I attempt to trigger these conditions the error logs keep reporting the following:

[groovy.canned.utils.ConditionUtils] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script32.groovy: 1: expecting ')', found 'xor' @ line 1, column 94.
== ('ClientName') xor (issue.
                            ^

1 error

 

Any help on this would be greatly appreciated. I believe it is just the way I have the syntax configured.

Thanks

Adam

 

1 answer

1 accepted

Accepted Answer
1 vote

"Exclusive or" is the caret ( ^ ) symbol - see http://groovy-lang.org/operators.html

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

22,016 views 2 7
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