Firing Webhook from 'Issue updated' listener.

Sayi.Iynapurapu December 12, 2023

Team,

 

I am trying to fire Webhook from custom listener (Issue updated) when a field called SLA changed,

I have use piece of code (as below) and updated Issue (by changing SLA) 

 

def webhookUrl = "https://xx.aaaa.one.com/http/sla.push"

// Post to webhook
new URL(webhookUrl).openConnection().with { connection ->
doOutput = true
requestMethod = 'POST'
setRequestProperty('Content-Type', 'application/json')
outputStream.withWriter { writer -> writer.write(json) }
}

received following error.

,716 WARN [runner.ScriptBindingsManager]: lastChangedField: SLA
2,871 ERROR [runner.AbstractScriptListener]: *************************************************************************************
,871 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: null
groovy.lang.MissingPropertyException: No such property: json for class: sun.net.www.protocol.https.HttpsURLConnectionImpl
at Script16$_run_closure1$_closure2.doCall(Script16.groovy:29)
at Script16$_run_closure1.doCall(Script16.groovy:29)
at Script16.run(Script16.groovy:25)

 

Note: We are on Data Centre 8.13.4 

Script runner 7.6.0

Please advise to fix.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events