Read More
Read More
Menu Close

    How To Use Custom Labels In Salesforce

    Custom labels are custom text values, which can be called from apex classes, visual force pages or lightning components. To support multilingual feature in an application, we can use custom labels that offer user’s to change/translate text values into any language that supported by salesforce. It helps to provide the best user experience that offers application in the user’s native language.

    Required Editions:

    Developer, Professional, Enterprise, Performance, and Unlimited Editions (both Salesforce Classic and Lightning Experience).

    User Permissions Needed
    Create, edit, or delete custom labels: Customize Application
    Create or override a translation: Manage Translation


    Searching for an experienced
    Salesforce Company ?
    Read More

    View Setup and Configuration and be designated as a translator

    Create a custom label:

    Click on Setup –> Build –> Create –> Custom Label

    In the custom labels, click ‘New Custom Label’ to create a new one.

    new custom label

    In ‘New Custom Label’, Enter the label description, categories(Text entered in this field can be used in filter criteria when creating Custom Label list views), mark the component as protected and value which is used to represent whenever this custom label is called upon in Apex, Visualforce or Lightning pages.

    new custom label data filling
    Create Translations:

    Open custom_label & click on ‘new’ under Translations.

    new translations

    Under ‘New Translation’, select your language & fill text that you want to show.

    Fill new translations

    Save It.

    Note: Translation workbench should be enabled & Your org must have some enabled language.

    Whenever this selected language is called upon using language code and custom label in Apex, Visualforce or Lightning page it shows the text which we provided in custom label translation text.

    Apex Syntax for Custom Label:


    Visualforce Syntax for Custom Label:


    Lightning Syntax for Custom Label:

    Use the following syntax to access custom labels in Lightning components(.cmp and .app resources only).

    • {!$Label.c.labelName} for the default namespace
    • {$Label.namespace.labelName} if your org has a namespace, or to access a label in a managed package

    Label in JavaScript code if your org has a namespace.

    • $A.get($Label.c.labelName) for the default namespace
    • $A.get($Label.namespace.labelName) if your org has a namespace, or to access a label in a managed package

    Note: You can create up to 5,000 custom labels for your organization, and they can be up to 1,000 characters in length. Custom labels from managed packages don’t count toward this limit.

    For any query please comment below or write us to [email protected]

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • kimmy kervel
    thanks for sharing this is really helpful for me and also for my upcoming project as well so i hope you to add some more in future also.. thank you once again for sharing
  • Back to Top