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
priyanshipriyanshi 

created by standard field

is it possible to access the created by standard field name of a record? how and what is its api?

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code snippet as reference:

 

list<contact> cc = [select id,CreatedBy.name from contact];

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

All Answers

SRKSRK

the API name of this field is CreatedById

so u can query like [select id,CreatedById,CreatedById.Name from Account where id = '1231231231'];

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code snippet as reference:

 

list<contact> cc = [select id,CreatedBy.name from contact];

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

This was selected as the best answer
priyanshipriyanshi

i am trying to display this field in a form-

 

<apex:outputField value="{!rep.createdbyid.name}"/>

 

however i am getting an error. any suggestions how to rectify? (rep is a variable)

priyanshipriyanshi

it worked. thanks :)

SRKSRK

My mistake

I write CreatedById.Name   it is CreatedBy.Name