Custom Label in Apex Class and Vf Page Salesforce

by Rijwan Mohmmed
2 comments
custom-lable-in-apex-class-and-vf-page-salesforce

Hello Friends, today we will learn Custom Label in Apex Class and VF Page(Visualforce Page) Salesforce. We use custom labels for translation text. Custom labels are simple text values that are accessed directly in the Apex class and VF page.

For creating custom labels,
Go To Setup —> Create — > Custom Labels.
Click on New Custom Labels. Enter the value for name, value, and description.
We can use custom label names to access custom label values in apex code using System.Label.labelName

and in Visualforce {!$Label.labelName}

Also Check this: custom label in lightning component

Use Custom Label In Apex :

public class CustomLabelTechdicer{
    public string customLabelValue{get;set;}
    public CustomLabelTechdicer(){
        System.debug(System.Label.techdicer);
    }
}

On Visualforce Page :

<apex:page>
   <apex:pageMessage severity="info" 
    strength="2" 
    summary="{!$Label.techdicer}" 
   />
</apex:page>
What’s your Reaction?
+1
0
+1
1
+1
1
+1
0
+1
0
+1
1

You may also like

2 comments

Dannielle November 8, 2021 - 6:55 am

I am regular visitor, how are you everybody? This piece of writing posted at this site is in fact fastidious.

Reply
Mattie November 10, 2021 - 5:26 am

Greetings from Colorado! I’m bored to tears at work so I
decided to browse your site on my iphone
during lunch break. I enjoy the knowledge you present here and
can’t wait to take a look when I get home. I’m shocked at how
fast your blog loaded on my mobile .. I’m not even using WIFI, just 3G ..
Anyhow, very good site!

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.