Running my Jira Java plugin results in a ComponentAccessor initialization error. Assistance is needed to properly fetch and display a custom field’s value. See example:
package my.plugin.sample;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.MutableIssue;
public class JiraComponentTest {
public static void main(String[] args) {
String ticketKey = "CAP-123";
String customFieldName = "Example Custom Field";
MutableIssue ticket = ComponentAccessor.getIssueManager().getIssueByCurrentKey(ticketKey);
Object fieldValue = ticket.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(customFieldName));
System.out.println("Custom Field Value: " + fieldValue);
}
}