Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to sort given value in groovy.

Hi Community,

In scriptrunner, I am having problem to sort the value these 2 variables: "participants" and "cfValpart"

For the following line:
if (participants != cfValpart){

The comparison is made but the value needs to be in order. Take for examples the following 2 mentioned scenario:
Scenario 1:
participants =

{John, Pierre, Alana}
cfValpart = {John, Pierre, Alana}

The comparison return true.
But Scenario 2:
participants =

{John, Pierre, Alana}

cfValpart =

{Pierre, John, Alana}

The comparison return false. (Where it should be true)

I have use to the following ".order" but the cfValpart is not accepting the function.

Can I have some advise or help on the issue

Best regards,
Jason Li

1 answer

Hi @Jason Li Ting Chung 

As long as both variables are Lists of the same type (eg. String), then you can use something like: 

if (participants.sort() != cfValpart.sort()) {

If not, use the groovy .collect { .. } construct to extract the values you want to compare into a List of Strings.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

196 views 1 6
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