Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Jira\Scriptrunner groovy code to write to a JQL searchable field

W_ Klein I'm New Here Dec 12, 2021

I have a working Jira Scriptrunner script which reads all of the linked issues and then based on linked type, writes that linked issue id to a custom field, example what the script does:

  • Current issue is abc-1 which has the scripted field on its screen and has a linked issue xyz-1 via a 'realizes' link type.
  • Writes 'xyz-1' to a custom field named 'Issues linked by realizes'. This custom field is a single line text type.

What I cannot find is a way is to search this custom field by value = 'xyz=1'.


  1. Is there a way to search a Jira text custom field for a value?
  2. Should I write, in the above example 'xyz-1', to different type of custom field which I can search?

1 answer

0 votes

You can't do this, and I think you've already worked out why!

Not because the idea or the code are wrong, but because text fields cannot be searched like that.  They take only fuzzy searches, and depending on your choice of project keys,  the JQL

"Issues linked by realises" ~ XYZ-1 

may not reliably do what you want!

The easiest thing that I think would fix this is to (re)create "Issues linked by realises" as a field of type "label".  Labels are directly searchable as though they are select lists, but do not need to have an option added to them before you can select it, so your code for populating the labels field would not have to do that as well as setting a value.

Suggest an answer

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

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

340 views 1 5
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