Hi Everyone,
We have done the integration from jira to pager duty.
When the ticket is created in jira, Automatically it should trigger the event in the pagerduty.
While adding the scripted post function during create transition getting below errors,
The variable [body] is undeclared, [variable response is undeclared] and No such property:messages for class: java.lang.object..
the following script as follows:
import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method
import groovy.json.JsonBuilder
import groovy.transform.BaseScript
if(issue.issueType.name=="ZIA OPS Escalation"){
def http = new HTTPBuilder("https://events.pagerduty.com/generic/2010-04-15/create_event.json")
def summary = issue.summary
def issueDetails = "ZIA OPS Escalation " + issue.key
def body
def issueJson = http.request(Method.POST, ContentType.JSON) {
body [ "service_key": "77011ebbefad47dd987f045636e04390","event_type": "trigger", "description": "summary", "details": "issueDetails"]
response.success = { resp, json ->
log.debug("PagerDuty Trigger Successful = " + json.messages)
}
response.failure = { resp, json ->
log.debug("PagerDuty Trigger Failed = " + json.messages)
}
}
}
@srikanth kocherlakota , I have the same problem when tetiing HTTP b uilder in script console, it says body, response, header are undeclared .
Did you find the problem?
regards
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.