Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

the variable issue is undeclared

Derek
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 11, 2017

Hello I have this script it was always working until I upgraded to the latest version... 

on ; 

MutableIssue issue = issue;  it says';

 

the variable issue is undeclared

 

----------->

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField unitInCharge = customFieldManager.getCustomFieldObjectByName("Unit in Charge");
MutableIssue issue = issue;

String unit = issue.getCustomFieldValue(unitInCharge).toString();

final String PLANT_MANAGER = "user.name";
final String LOGISTICS = "user.name";
final String PRODUCTION = "user.name";
final String HSEQ = "user.name";
final String MAINTENANCE = "user.name";
final String PROCESS_ENGINEERING = "user.name";
final String PROJECT_ENGINEERING = "user.name";
final String LABORATORY = "user.name";
final String HUMAN_RESOURCES = "user.name";

switch(unit) {
case "Plant Manager":
issue.setAssigneeId(PLANT_MANAGER);
break;

case "Logistics":
issue.setAssigneeId(LOGISTICS);
break;

case "Production":
issue.setAssigneeId(PRODUCTION);
break;

case "HSEQ":
issue.setAssigneeId(HSEQ);
break;

case "Maintenance":
issue.setAssigneeId(MAINTENANCE);
break;

case "Process Engineering":
issue.setAssigneeId(PROCESS_ENGINEERING);
break;

case "Project Engineering":
issue.setAssigneeId(PROJECT_ENGINEERING);
break;

case "Laboratory":
issue.setAssigneeId(LABORATORY);
break;

case "Human Resources":
issue.setAssigneeId(HUMAN_RESOURCES);
break;

default:
break;
}

issue.store();

1 answer

0 votes
Alex Koxaras -Relational-
Community Champion
September 6, 2021

Hi @Derek 

Did you read the latest documentation from Adaptavist? They probably have change something, and that;s why your code stop working.

https://docs.adaptavist.com/sr4jc/latest/features

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events