function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jaysree Ajaysree A 

Custom labels

Can you please give me one realtime senario for custom Label
Best Answer chosen by jaysree A
Mahesh DMahesh D
Hi JaySree,

(1) If you want to display the labels like error messages or warning messages in the users language then
using the custom labels we can achieve it. Otherwise those will always display in English language only.

(2) Also any of the labels if you want to use it in your code, rather than hard coded them, create a Custom Label and maintain so that it will be easy to manage them.

In general definition:

Custom Labels
Custom labels are custom text values that can be accessed from Apex classes, Visualforce pages, or Lightning components. The values can be translated into any language Salesforce supports. Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user's native language

Please look into the below links:

https://help.salesforce.com/HTViewHelpDoc?id=cl_about.htm

https://help.salesforce.com/HTViewHelpDoc?id=cl_edit.htm&language=en_US

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_label.htm

https://developer.salesforce.com/forums/?id=906F00000008vG8IAI


Please do let me know if it helps you.

Regards,
Mahesh

All Answers

Mahesh DMahesh D
Hi JaySree,

(1) If you want to display the labels like error messages or warning messages in the users language then
using the custom labels we can achieve it. Otherwise those will always display in English language only.

(2) Also any of the labels if you want to use it in your code, rather than hard coded them, create a Custom Label and maintain so that it will be easy to manage them.

In general definition:

Custom Labels
Custom labels are custom text values that can be accessed from Apex classes, Visualforce pages, or Lightning components. The values can be translated into any language Salesforce supports. Custom labels enable developers to create multilingual applications by automatically presenting information (for example, help text or error messages) in a user's native language

Please look into the below links:

https://help.salesforce.com/HTViewHelpDoc?id=cl_about.htm

https://help.salesforce.com/HTViewHelpDoc?id=cl_edit.htm&language=en_US

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_label.htm

https://developer.salesforce.com/forums/?id=906F00000008vG8IAI


Please do let me know if it helps you.

Regards,
Mahesh
This was selected as the best answer
venkat-Dvenkat-D
General two use cases
1) Translations in visual force pages. You have a custom error message that you want to display to user and it needs to be translated based on user language. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_label.htm
2) Use some values in apex or formulas taht migth change in future and to void code changes 
Ex : listofprofiles that shoule be allowed. label value will be System Administrator;Read Only User
Now you can use this label in apex and query for pofiles to allow certain functions. 
https://help.salesforce.com/HTViewHelpDoc?id=cl_about.htm
jaysree Ajaysree A
Hello,

Can you plz give me one example