the variable issue is undeclared

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();

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

36 views 0 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you