Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get custom field object by name? Edited

Hello Community,

Jira S 8.6.1

Trying to get customfield by name and no method seems to work.

I see in docs that getCustomFieldObjectByName() is deprecated and now we have to use

getCustomFieldObjectsByName() but its not working.

getCustomFieldObject() + customfield_xxxxx does the job, but I'd like to get them by name, anyone knows a working way?

I want a single customfieldobject no a collection

Thank you

1 answer

0 votes
Payne Community Leader Jan 29, 2020

getCustomFieldObjectsByName() returns a collection, so you need to get one value from it. If you have only one custom field by the name that you specify, then you can simply use getCustomFieldObjectsByName("myField")[0]

Hello Payne,

First, thank you for your answer.

I am a little lost, since now its working with the single deprecated method

getCustomFieldObjectByName()

But the input parameter needs to be translated

To give you an example:

  • Editting the custom field the name is Relevance
  • In the Custom Field's list its name is in spanish Relevancia

With the translated input string works...

Something has changed or I am missing something.

I've found this:

Method getCustomFieldObjectsByName() doesn't accept the right input parameter 

Thank you in advance 

@Andreas Ebert  Wrote this

Fyi @Atlassian, I think the bug it due to how the internal cache in CachingCustomFieldManager is initialized: CustomFieldInMemoryStore uses CustomField::getName to populate the Map byName, and since CustomField::getName is locale-dependent on the current user, it uses that user's translated name. Which is wrong. CustomFieldInMemoryStore shouldn't use the translated name. It should use CustomField::getUntranslatedName.

I think its What is happening here.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you