We want JIRA to update an external app using a webservice. Unfortunately, the webhooks feature will not work as the webservice will only accept certain mapped parameters. Webhooks sends a complete issue dump. I think SIL services or Listeners is out because we want to use JAVA to call the webservice. Other options might be a Jelly service or Groovy script listener.
Community moderators have prevented the ability to post new answers.
The only event that invokes the listener is Create. We really need Issue Resolved,Closed or Issue commented to work.
Is there another method besides workflowEvent that we are supposed to call for these events?
public void workflowEvent(IssueEvent event) throws IOException
> throws IOException have you got the logs? So you're saying the same method works for create?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the atlassian-jira.log, but nothing gets written to nor any errors appear. Just silence. It is the same exact code for Create issue event which works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried writing to a file also. Do I have my groovy file in the correct place? It is under atlassian-jira\WEB-INF\classes\com\Brian. Some confusion because some people have said they placed it in the groovy.jar file under com.onresolve.jira.groovy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No - it needs to be in <jira.home>/scripts/com/Brian You don't normally begin a package with an uppercase letter, although I don't think it will cause a problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did not see in 2.1.16 Documentation that this is the directory to use - only in later versions. when I preview the script under WEB-INF from Add Listener, I get no errors. Now when I move the groovy script to scripts/com/brian, I get "Problem loading class: com.brian.ExampleListener"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there any way you can upgrade to a more recent jira version?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On the old version then yes it needs to be under web-inf/classes. The old documentation is at https://jamieechlin.atlassian.net/wiki/display/GRV/Listeners. IIRC you need to enter the class name, eg com.foo.Bar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try putting the listener on another event, like "create". There shd be something in the log file. Set the plugin log level to debug https://scriptrunner.adaptavist.com/latest/jira/getting-help.html#_support_requests.
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.
3.0 +
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You didn't say what version of jira you have, maybe you don't need to. Even if not, you could do it with HttpClient, which is included in jira. If you give us the same curl command I can suggest the next step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For testing, I'm just going to invoke the REST API of another JIRA instance. curl -D- -u usern2:psswd2 -X PUT --data @jiraAPItest -H "Content-Type: application/json" http://myjirainstance.com/rest/api/2/issue/OCES-34876 { "fields": { "assignee":{"name":"cbashyb"} } } Ideally an event (issue-commented, or issue-updated) would trigger the listener
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
before I add my curl statement - I built a custom listener using your example. I get no errors when I preview, but do not see any log output when I update an issue. Which log does it actually write to? package com.Brian; import org.apache.log4j.Category; import com.atlassian.jira.event.issue.AbstractIssueEventListener; import com.atlassian.jira.event.issue.IssueEvent; import com.atlassian.jira.ComponentManager; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.issue.ModifiedValue; import com.atlassian.jira.issue.MutableIssue; import com.atlassian.jira.issue.util.DefaultIssueChangeHolder; import com.atlassian.jira.issue.util.IssueChangeHolder; public class ExampleListener extends AbstractIssueEventListener { Category log = Category.getInstance(ExampleListener.class); //log.setLevel(org.apache.log4j.Level.DEBUG); @Override //void issueUpdated(IssueEvent event) { public void workflowEvent(IssueEvent event) { log.debug ("Hi Brian -Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by ExampleListener"); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that's a custom listener.. you can just write it as a script rather than a class: https://scriptrunner.adaptavist.com/latest/jira/listeners.html#_custom_listener_example It writes to <jira-home>/logs/atlassian-jira.log, but only if you have set the log level to debug.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would work out what you want to post and use curl to test it. Once done it's easy to replicate that using HttpBuilder, which is included in scriptrunner. You can create the payload using JsonBuilder, if it takes json.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For this kind of customization, I usually let a separate entity to handle it (external it) so in JIRA, the change I really need to do is to know where it is.
So If I were to do this, I will create a shell/groovy script that will be invoked during workflow transitions or listener events.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.