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:
ScriptFieldCreationInfo.Builder.newBuilder().setSearcherKey("datetimerange")
All I can succeed with is the example, and the no argument option.
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") .setTemplate("custom") .setSearcherKey(ScriptRunnerImpl.PLUGIN_KEY + ":textsearcher") .setScript('issue.reporter?.emailAddress?.replaceAll(/.*@/, "")') .setGlobalContext() .setCustomTemplate('''\ $value - <a target="_blank" href="http://$value">Company domain</a>''') .build() def cf = scriptFieldCreation.create()
Hope that hepls.
Regards,
Thanos
Yes, thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.