Accessing a CustomField value

Hello and thanks to anyone who takes the time to read my question.

I have this trite question about how to access the value of a customfield using java developing a plugin for jira. I know there is a lot of question related to this in the community but none of which solved my problem.

Here it is, I need to access the value of a particular CustomField during the creation of an Issue. I manage to access to any other value like reporter, assignee, summary, etc with methods like getReporter, getAssignee, etc but when I try using getCustomFieldObjectsByName(“customField”) I only get null, but debugging the code I can see the real value of the CustomField, something that’s really weird for me. (I mean see the value but no able to get the value)

The code:

UsersA[] usuariosA = ao.find(UsersA.class,“Author = ?”, issue.getExternalFieldValue(customFieldManager.getCustomFieldObjectByName(“Author”).getValue(issue).toString())));

since getCustomFieldObjectByName is deprecated I had to use getCustomFieldObjectsByName, but I only get null.

I also tryied this

ao.find(UsersA.class,“Author = ?”, issue.getExternalFieldValue(customFieldManager.getCustomFieldObjectsByName(“Author”).toString())))

Is there a right way to access to a customfield value?

Thanks a lot in advance.


Just to let you know that I’ve finally managed to solve this using:

String uS = customFieldManager.getCustomFieldObjectByName(“Author”).getValue(issue).toString();

using getCustomFieldObjectByName, I’m not so happy using it since it’s deprecated. so if anyone knows how to solve this using getCustomFieldObjectsByName, I’m all eyes!.

Thanks again.

1 Like