I'm completely new in JIRA, please be patient :)
I've prepared custom Listener
package com.onresolve.scriptrunner.canned.jira.workflow
import com.onresolve.scriptrunner.canned.CannedScript
import com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener
import com.onresolve.scriptrunner.runner.ScriptRunner
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
import com.onresolve.scriptrunner.runner.customisers.ScriptListener
import groovy.util.logging.Log4j
@ScriptListener
@Log4j
class SampleScriptListener extends CustomListener implements CannedScript {
ScriptRunner scriptRunner = ScriptRunnerImpl.getScriptRunner()
@Override
String getName() {
"Sample custom listener"
}
@Override
String getDescription() {
"Sample listener from a plugin"
}
@Override
Map doScript(Map<String, Object> params) {
log.warn("ScriptRunner listener: do something here") scriptRunner.runScript("com/example/SampleScript.groovy")
return params
}
@Override
String getDescription(Map<String, String> params, boolean forPreview) {
"preview description xxx"
}
}
and set it properties in scriptrunner.yaml file
!descriptor# jira listenersscriptListeners:
- FIELD_LISTENER_NOTES: A sample listener
FIELD_MY_PARAM: my custom param
canned-script: com.onresolve.scriptrunner.canned.jira.workflow.SampleScriptListener events:
- 1
- 2
- 3
- 4
- 5
- 6
- 10
- 11
- 12
- 14
- 15
- 18
- com.atlassian.crowd.event.user.UserCreatedEvent projects:
- 'testp'
Custom groovy script looks like this.
package com.example
log.warn "log from custom script"
return "return from custom script"
When I created script listener manually (in the GUI) it worked fine. It was possible to edit parameters and after declared action (assign) script logged in to the console. problem is that ScriptListener created in scriptrunner.yaml is inactive and I can't edit it parameters.
My question is where can I find documentation for this functionality or how to prepare scriptrunner.yaml.
Hello,
You can find information on generating the scriptrunner.yaml file here. You might want to just take a look at the entire Creating a Script Plugin page from the documentation, it contains quite a bit of useful information that should help you get started.
Please let me know if you have any further questions!
Jenna
Hi.
Thank you for the answer.
It's makes more sense to generate scriptrunner.yaml than writing it :)
Informations from "Creating a Script Plugin" article give us possibility to get new data from property file by running "mvn package". Is there another way to perform the same task from GUI perspective?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't believe there is at the moment. You'll have to do that manually.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.