function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michael_KahleMichael_Kahle 

Apex Describe Field ApiNames not CaseSensitive

Hi,

 

i'm writing a Visualforce Controller where i need to get the Api Names of the fields of a specific Object, but everything i get is only lower case. I actually need them like they are originally named, because of a WebService Call i'm doing with those field names.

 

Is there any way to get the api names of fields and objects original, and why are they lowercase anyway?

 

Thanks

Michael Kahle

wesnoltewesnolte

Hey

 

Check the labels and names for your object and fields in the Setup>create>objects menu. Perhaps they've been captured in lowercase.

 

Wes 

Michael_KahleMichael_Kahle

Hi wesnolte,

 

I get the Labels perfect, the problem are the Api Names of fields and objects. Even the Standard ones like "BillingCity" is given back as "billingcity. So it's not a issue of how they've been captured.

 

thanks

 

Michael Kahle

wesnoltewesnolte

Cool, had to ask;) How are you getting the names of the objects and fields? Using describes?

 

Wes

Michael_KahleMichael_Kahle

Hi wesnolte,

 

I found the problem, i used the fields.getMap().keySet() function which only contains lowerCase. Now i'm getting every Name i need with the describeField(name).getName() and getting the original names.

 

Thanks for your help

 

Michael Kahle

TeeJay BagainTeeJay Bagain
Hi Michael Kahle. 

Can you explain how you  got the API Names with your method?

Thank you!