You need to sign in to do that
Don't have an account?

CreatedBy.Name not returning the name but returns ID
The following query returns createdbyid/LastModifiedbyId instead of name in apex whereas returns name when using workbench or query editor in dev console. How do i get the name directly instead of ID?
select Customer_Number__c,Name,Quality_Rating__c,Primary_Institution_Type__c,CreatedBy.Name,CreatedDate,LastModifiedBy.Name,LastModifiedDate from Account WHERE ID =: myID
select Customer_Number__c,Name,Quality_Rating__c,Primary_Institution_Type__c,CreatedBy.Name,CreatedDate,LastModifiedBy.Name,LastModifiedDate from Account WHERE ID =: myID
If you are using a debug statemnet to view the output, then you will only see the Ids, however, you will be able to reference the actual names. For example, if you had something like this The debug statemnets would correctly display the User's name and not the Id.
Please remember to mark this thread as solved with the answer that best helps you.
Kind Regards
Stephen