We have an approval process, with just one approval level. I'm using ScriptRunner to try and capture who approved the issue so I can pass it onto a new issue that gets created after the approval process.
Everything that I've found online or using AI does not give me the results that I'm looking for.
Here's the script that I'm using to test this functionality. In this example, someone named Tim approved Key-123.
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.servicedesk.api.approval.ApprovalService
import com.atlassian.servicedesk.api.approval.ApprovalDecisionType
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.atlassian.servicedesk")
//Get LOGS issue
Issue logissue = Issues.getByKey("Key-123")
def approvals = logissue.getApprovals()
//def approvalService = ComponentAccessor.getOSGiComponentInstanceOfType(ApprovalService)
//def approvalUser = approvalService.getApprovals(logissue)
//def approvalUser = approvals[0].getApprovers().getProperties().getClass().methods.collect { it.name }
def approvalUser = approvals[0].getApprovalCondition().getMetaClass().methods.collect { it.name}
//.getClass().methods.collect { it.name }
return approvalUser