Valid searchers and their keys in Scriptrunner unit test helper

I would like to do unit tests with easy creation of issues with custom fields with Scriptrunner.


I am looking for valid searcherKey arguments in code like:



All I can succeed with is the example, and the no argument option.

1 answer

Hi Thorsten,

So the available serachers for scirpted fields will be 

.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":textsearcher")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":datetimerange")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":exacttextsearcher")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":exactnumber")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":numberrange")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":userpickersearcher")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":multiuserpickersearcher")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":durationsearcher")
.setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":versionsearcher")

Therefore an example of creating a scripted field with a textsearcher and a custom template would be 

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.test.ScriptFieldCreationInfo

def scriptFieldCreation = ScriptFieldCreationInfo.Builder.newBuilder()
    .setName("A scripted field example")
    .setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":textsearcher")
    .setScript('issue.reporter?.emailAddress?.replaceAll(/.*@/, "")')
    $value - <a target="_blank" href="http://$value">Company domain</a>''')

def cf = scriptFieldCreation.create()

Hope that hepls.



Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

359 views 0 6
Read article

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