Referencing the localized label for the standard CreatedBy relationship (localized version of “Created By”)

I’m trying to reproduce the “Created By” and “Modified By” fields in one of my Visualforce pages, and I’m almost there.

      <td>Created By</td>
        <apex:outputLink value="/{!Custom_Object__c.CreatedBy.Id}">
        <apex:outputText value=", {!Custom_Object__c.CreatedDate}"/>

I need to replace the text Created By with a dynamic label localized for the current user. I’ve tried {!$ObjectType.Custom_Object__c.Fields.CreatedBy.Label}, but I get an Unknown property error when I try to save. I can’t use Fields.CreatedByID.Label since that’s actually the text Created By ID.

Do I need to do something with getChildRelationships()? Look it up in my Apex code and expose it to Visualforce?

Or is this a case where I’m not going to find a label that contains a localized version of Created By and I have to choose between Created By ID, Created Date, or creating my own label and translations?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’ve had a look around at this, i agree it does seem frustrating you cannot reuse this label and the translations that Salesforce have provided. I think the problem stems from the fact that all the Visualforce and Apex options available utilise the Apex Describe behaviour, which is bound to the underlying schema of your object, as can be seen by this from Eclipse, there is not such field, so I assume its UI thing.

enter image description here

On this basis, I’m pretty sure your only real solution is to use Custom Labels as has been mentioned in the comments, accessed via $Label described here. If your unsure of the translations to put into the Custom Label, I guess you can switch your user into each language and copy paste!


Method 2

Did you try to expose to VF schema label from an apex controller? Something like

String createdByLabel = CustomObject.CreatedById.getDescribe().getLabel();

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x