Fetch the Label Value using Salesforce Apex Class and Visualforce Page
Custom labels are custom text values that can be accessed from Apex classes or Visualforce pages. Yes, we can fetch the Label Value both apex class and visualforce page.

first create a Label using below path:
Setup-> App Setup-> Create-> Custom Labels
Create new label Called ‘Event Title’ and use the below code,
Apex Class:
String printLabel = Label.Event_Title;
system.debug(‘printLabel::’+printLabel);

Visualforce Page:
<apex:sectionHeader title=”{!$Label.Event_Title}” />

Note : we can create up to 5,000 custom labels and they can be up to 1,000 characters in length.

https://help.salesforce.com/htviewhelpdoc?id=cl_about.htm&siteLang=en_US

Written by 

Salesforce MVP | Lightning Champion | 16x Salesforce Certified | Application Architect | 6x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

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

*