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

(3185)

Written by 

I am Sakthivel Madesh, a certified Salesforce Developer & Administrator working on Salesforce Technology since 2011. I am currently working in Techforce Services as Sr. Salesforce Developer. I have worked on multiple technologies Like PHP, Java, Salesforce, I am very passionate about Salesforce and to earn 13x Salesforce Certification. I love Trailhead for learning Salesforce Skill and Become a Trailhead Ranger too. I Love to Learn & Share my Salesforce knowledge to Salesforce Learners/Beginner using My Blog and Salesforce Community.

Leave a Reply