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;

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.


Written by 

2x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

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