Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Scriptrunner to compare two Select List (single choice) fields

Hi

I have two custom fields that are type Select List (single choice):

  • Health (This Week) - customfield_21107
  • Health (Last Week) - customfield_21108

Both custom fields have the same options available for selection

  • Not Started
  • On Track
  • Off Track
  • Done

I would like to run a query where I can return a list when Health (This Week) = Health (Last Week). I would also like to be able to run the inverse query, where Health (This Week) != Health (Last Week).

I have tried:

issueFunction in issueFieldMatch("", "customfield_21108", customfield_21107)

but I don't get any results (even though I should). I think the third argument isn't being resolved?

I've also tried: 

issueFunction in expression("", "customfield_21108 = customfield_21107")

 but I don't get the results I expect. Interestingly I get the same results with "=" or "!="

 

Any suggestions?

1 answer

1 accepted

2 votes
Answer accepted

Hi Kristin,

I don't think those work with select list custom fields, but only with number and dates, which support comparison.

You could create a script to loop over each issue in a given JQL search ( like cf[21107] is not empty and cf[21108] is not empty ).

The script should return the issuekey for each issue where the cfs have the same value.

 

If you don't want to create a script for that, you could simply use the JQL below, since there aren't maby values to compare:

(cf[21107] = "Not Started" AND cf[21108] = "Not Started" ) OR (cf[21107] = "On Track" AND cf[21108] = "On Track" ) OR (cf[21107] = "Off Track" AND cf[21108] = "Off Track" ) OR (cf[21107] = "Done AND cf[21108] = "Done" )

To see where they are not the same, save the above JQL in a filter and create another one like:

cf[21107] is not empty and cf[21108] is not empty AND filter != 1234

Replace 1234 with the ID of the filter you saved. It should return all issues where the cfs are not empty and not equal.

 

Regards,

Ioana

I implemented the JQL and filters - works perfectly. Thanks Ioana!

Suggest an answer

Log in or Sign up to answer
TAGS

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