I created a script in script listener when an attachment is created in a Jira issue it converts the attached file in base 64 . This converted file i must send in a ServiceNow incident. To do this i need to find the Jira issue number from where i must extract de incident number. I tried different solutions but i am unable to get the jira issue id (key) Can somebody help me with this issue?
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.event.type.EventDispatchOption
@WithPlugin("com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FireIssueEvent") void execute(IssueEvent event) {
def issue = event.issue
// Log the issue key and other details
log.info("Issue Created: ${issue.key}, Summary: ${issue.summary}, Project: ${issue.projectObject.key}")
// Display a message to the user (optional)
UserMessageUtil.success("Issue Created: ${issue.key}, Summary: ${issue.summary}, Project: ${issue.projectObject.key}")
// Additional actions can be performed here
}