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

Your Points Tracker
  • 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
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?
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

Get list of issues from a project and check custom field values Edited

Using Script Runner and Behaviors

I am looking to pull all issue id's for a specific project and then for each issue, compare one of its custom field values to a string. This string will be whatever the user entered into that custom field for that specific issue on the form (CR Number).  If the custom field value (from all the other issues) is equal to that string (what was entered), then I need to raise an error stating that the value needs to be changed (no duplicates of "CR Number" are allowed)

What I have so far is I am able to get the list of all issues from my project and I believe all Issue objects have their field values in the said object.  

So now I want to do my comparison:

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;

def issueMgr = ComponentAccessor.getIssueManager()
def issues = issueMgr.getIssueObjects(issueMgr.getIssueIdsForProject(10000))

//Here - how do I get what was entered into the custom field and compare it to all the CR NUMBER fields of the returned Issue item list (issues)

def input = getFieldById("customfield_10302")
def val = input.getValue() as String

for (int i = 0; i < issues.size(); i++){

  //raise an error here and user must try a different value


1 answer

0 votes

@Justin G 

Hmm what you are trying to do has a lot of performance penalty, imagine looping 20,000 issues just to compare the values every time the Custom Field changes.

What I will do is fix the custom field value of the existing tickets by doing a bulk update.

And in the behavior I will then properly filter the value of what the user will input.

That way you future proof any data that will be written in your instance.

Thanks for your response, however I am not able to understand what you are suggesting.  Can you please also include code snippets or pseudo code?

Suggest an answer

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

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

335 views 9 7
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