I have a standard jira issue:
com.atlassian.jira.issue.Issue issue
and a field object:
com.atlassian.jira.issue.fields.Field field
My goal is to get the value of field in issue. I have checked the API and only issue.getExternalFieldValue(field) seems usable, but that is not working (java.lang.UnsupportedOperationException: Not yet implemented).
Note that this problem In case of CustomField is trivial:
issue.getCustomFieldValue(field)
I was looking for that as well, but no luck.
I'm developing a workflow validator that is configurable - user can set any field to be validated. I can get the Field instance by field id (fixVersion, customfield_10000, or whatever), but I cannot then get it's value in context of an issue.
Any experts here?
The workaround solution I used:
public String getFieldStringValue(Field field, Issue issue) {
if (field instanceof AbstractTextSystemField) {
AbstractTextSystemField textSystemField = (AbstractTextSystemField)field;
return textSystemField.getValueFromIssue(issue);
} else if (field instanceof ImmutableCustomField) {
CustomField customField = (CustomField)field;
Object value = issue.getCustomFieldValue(customField);
if (value instanceof String) {
return (String)value;
} else {
return null;
}
} else {
throw new UnsupportedOperationException("msg");
}
}
It works for string field types, however there is no guarantee that it works in all cases even for string field types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, I don't work with JIRA for the last 3 years, so I didn't figure it out
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any update on this issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.