the variable issue is undeclared

Derek 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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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