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
Sam AlexSam Alex 

get Contact First Name from Contact Object

Hi,

I want to get the First Name of the Contact Object. When I go to the Contact Objects Fields, they only have a field called NAME. NAME is a combination of (PreFix, First Name and Last Name). 

Is there a way to access the First Name of that conatct from apex code?

Please Help me.

Thanks in advance.
Sujan Kumar ReddySujan Kumar Reddy

Hi Sam,

Contact FirstName directly we can access in our SOQL.

Try this query in Developer Console.

SELECT FirstName FROM Contact

User-added image

 



 

Sam AlexSam Alex

Hi Sujan, 

Thanks for your quick response. I will give it a try.

Cant we access it like, ContactObject.FirstName?

Thanks.

Sam AlexSam Alex
Hi Sujan,

the value is now comming. And also we can access the same value from the object it self. 
contactObject.FirstName
Thank you.
 
Sujan Kumar ReddySujan Kumar Reddy
:)