Hi ,
I am using the below code to clone issues which works fine until there is an user (in assignee field) who is invalid(no longer with company or without license) and haven't been removed from the user field. I am not sure if there is an option to bypass this field.
Any suggestions would be appreciated?
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Category
import org.apache.log4j.Logger
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import org.slf4j.LoggerFactory;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def changeHolder = new DefaultIssueChangeHolder()
import org.apache.log4j.Category
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.setLevel(org.apache.log4j.Level.DEBUG)
//def log =LoggerFactory.getLogger("com.onresolve.jira.groovy")
def issueManager = ComponentAccessor.getIssueManager()
def issueFactory = ComponentAccessor.getIssueFactory()
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = issue
// **** start of cloning release logic ****
def toclone = issueFactory.cloneIssueWithAllFields(issue)
def cloned = issueManager.createIssueObject(loggedInUser,toclone)
log.info("CLONED ISSUE KEY: ${cloned.getKey()}")
// **** end of cloning release logic ****