I'm have some issue with a ScriptRunner / Groovy script.
Improving our Incident and Problem process,
Have a defined class with a constructor that takes an issue and populates a variable.
I can create one instance of the class and everything works as expected.
The moment i create a 2nd instance on the same class, the 1st one i created returns the same values as the newly created class.
import ASI.Issue_Client
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level
import org.apache.log4j.Logger
def logOutput = Logger.getLogger('CONSOLE')
logOutput.setLevel(Level.DEBUG)
logOutput.info('Script Starting')
def issueManager = ComponentAccessor.getIssueManager()
Issue_Client activeIncidentIssue = new Issue_Client ( issueManager.getIssueObject( 'issue-94002' ) )
logOutput.debug('activeIncidentIssue: ' + activeIncidentIssue.WorkingIssue.key)
logOutput.debug('----------')
Issue_Client activeProblemIssue = new Issue_Client (issueManager.getIssueObject( 'issue-94123' ))
logOutput.debug('activeIncidentIssue: ' + activeIncidentIssue.WorkingIssue.key)
logOutput.debug('activeProblemIssue: ' + activeProblemIssue.WorkingIssue.key)
I get the following log output:
2023-09-28 13:11:25,933 INFO [CONSOLE]: Script Starting
2023-09-28 13:11:25,949 DEBUG [CONSOLE]: activeIncidentIssue: issue-94002
2023-09-28 13:11:25,949 DEBUG [CONSOLE]: ----------
2023-09-28 13:11:25,949 DEBUG [CONSOLE]: activeIncidentIssue: issue-94123
2023-09-28 13:11:25,949 DEBUG [CONSOLE]: activeProblemIssue: issue-94123
The activeIncidentIssue should remain the same value
The key values from my class definition are:
public class Issue_Base {
public static Issue WorkingIssue
public Issue_Base (Issue issue) {
WorkingIssue = issue
}
}