I'm trying archive an issue via MyGroovy plugin and I found this code in the community:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.archiving.ArchivedIssueService
@StandardModule
ArchivedIssueService a
def authContext = ComponentAccessor.getJiraAuthenticationContext()
//issue = ComponentAccessor.getIssueManager().getIssueObject("TESTISSUE-1234")
def validationResult = a.validateArchiveIssue(authContext.getLoggedInUser(), issue.getKey());
if (validationResult.isValid()) {
a.archiveIssue(validationResult);
}
But when I put this code in the Console, this error appears:


How can I fix it ?