How to use custom labels in salesforce

Custom labels are custom text values, which can be called from apex classes, visual force pages or lightning components. These text values can be translated into any language that Salesforce supports.

Custom labels can be used to create multilanguage applications, which are useful to translate information in user's native language.

Create a custom label:

Click on Setup --> Build --> Create --> Custom Label

In the new Custom Label enter the label description, categories(Text entered in this field can be used in filter criteria when creating Custom Label list views), mark the component as protected and value which is used to represent whenever this custom label is called upon in Apex or Visualforce pages.

When you click on Custom Label which is already created, you can find translations or else enable translation in Translation Workbench.

Create Translations:

Enter into the custom label to which you want to create translation.

Click on the new and select the language(languages that have been previously activated in the Translation Workbench, and languages that do not have a local translation or override already created) and provide the translation text.

Note:

The translation language should be added and make it active in the Translation workbench.

Whenever this selected language is called upon using language code and custom label in apex or visual force page it shows the text which we provided in custom label translation text.

Syntax for custom label:

In Apex use System.Label.Labelname

In Visualforce page use {!$Label.Label_name}

Note:

We can create up to 5000 labels in an organization and they can be 1000 characters in length.

Custom Labels in managed packages doesn't come in count with the limit mentioned above.

Custom Label is called upon in an apex or visual force page so that the values mentioned on the custom label are returned as output. This text value can be changed by editing custom label and creating translation text with required language.

Whenever, language with its code like language="code" is called upon in an apex or visual force page along with custom label then the text value is represented in the specified language. So, by this way we can change the application into multilingual.

Posted On 28 February 2018 By MicroPyramid


Need any Help in your Project?Let's Talk

Latest Comments
what is salesforce and what does it do?

Now a days salesforce is one of the first global company to successfully utilize a cloud-based CRM software. Salesforce has been able to leverage cloud …

Continue Reading...
Is Salesforce good for small business?

Get detailed information about how salesforce is good for small business and it's advantages and disadvantages

Continue Reading...
Tips and Best Practices on how to use Salesforce campaign Management Effectively

Tips and Best Practices on how to use Salesforce campaign Management Effectively to increase the number of leads.

Continue Reading...
Salesforce Source code management with Visual Studio code, Git and GitHub

Salesforce made an easy to manage Salesforce source code with Visual Studio Code and GitHub by providing necessary extensions in the Visual Studio Code and …

Continue Reading...
Highlights of salesforce summer '18 release notes

Salesforce gets its CRM updated for every release. Generally, Salesforce has three releases per year(spring, summer, winter). In this we are going to look into …

Continue Reading...
Creating custom Splash page in Salesforce

In many websites, we come across a page displaying first and then redirecting to the main website page automatically or clicking on a button, which …

Continue Reading...
Set up of Communities in Salesforce

In any business communication among employees, customers, users and clients are very important. To collaborate and communicate in Salesforce we use communities. Communities will make …

Continue Reading...
How to use Set in Salesforce

Apex provides collections such as List, Set, Map. These are similar to arrays, but these collections have advanced features and easier methods than an array. …

Continue Reading...
How to use custom labels in salesforce

Salesforce is used by many users whose native languages are different, If the application doesn't have any Multilanguage feature, it would be difficult for the …

Continue Reading...
How to set up Email-to-Case and On-Demand Email-to-Case

In any Organization, Support is important to enhance good relationship with their customers. In Salesforce, whenever a customer mails any need of support or interaction …

Continue Reading...
How to create reminder or automatic reminder in salesforce

In salesforce organization, when you have to work on lot of leads and each lead will be at different stage. To make it easier to …

Continue Reading...
How to share data between two Salesforce organizations using Salesforce to Salesforce connection

Customers have their own organizations in a shared platform. Sometimes, one organization may require to fetch data from the other one. To share data between …

Continue Reading...
How to use list methods in salesforce

Apex provides collections such as List, Set, Map. These are similar to arrays, but these collections have advanced features and easier methods than an array. …

Continue Reading...
Packages in salesforce

In the salesforce organization, when you are building a component or application, it's important to know how the component or application should be distributed to …

Continue Reading...
Approval process in Salesforce

As we know there will be role hierarchy in many organizations and permissions are assigned according to their roles. So, When a record or data …

Continue Reading...
How to set up outbound messaging in salesforce

When you want to send information from Salesforce organization to any third party external service, Outbound messaging is used in Salesforce. It is a part …

Continue Reading...
How to use Data loader in Salesforce

In any business importing and exporting of data is very important. Only to some extent, we can enter the data manually in the fields of …

Continue Reading...
How to create Master-detail relationship in Salesforce?

In Salesforce, relationships are used to create a link between objects. Whenever user clicks on particular object they can view its data and related data …

Continue Reading...
How to send email to a public group in Salesforce

In Salesforce it is quite difficult to send email to users individually when there are many. So, upon creating public groups with required users working …

Continue Reading...
Field Update Workflow in Salesforce

In Salesforce, field update is used to change or update field records. This can be done by a creating field update actions and associating them …

Continue Reading...
How to create custom list views

In Salesforce, when you go to the home page of any object, you will get to see a standard view of records in that object. …

Continue Reading...
How to set up escalation rules in salesforce

In many businesses, when customers raise cases, and they are assigned manually to the agents by looking over the case details. But nowadays, cases are …

Continue Reading...
How to use Map methods in Salesforce

Apex provides collections such as List, Set, Map. Each collection has its own properties and characteristics that make them to use widely in salesforce. One …

Continue Reading...
Basic Live Agent Implementation

Customers in these days expect quick resolutions to their queries. In Salesforce, to resolve queries for the customers in a fast and efficient manner, we …

Continue Reading...
How to run a SOQL query in Salesforce

Salesforce Object Query Language(SOQL) is used to fetch the data from Sobject in salesforce organization. As we know SQL is used by .Net developers to …

Continue Reading...
How to create Web-to-case in Salesforce

Customers can submit their cases directly in their website using a simple web-to-case form. These forms are used to convert submitted information into customer support …

Continue Reading...
How to access Schema builder in Salesforce

Schema builder in Salesforce is used to get all the objects and different kinds of relationships in one place. It can be used to modify …

Continue Reading...
How to create one to one relationship between objects in salesforce

Salesforce provides two relationships known as one to many relationship and many to many relationship(this can be done using junction object). Hence in this, we …

Continue Reading...
Process Builder in Salesforce

Process builder is the best automation tool available in Salesforce which can perform complex workflows seamlessly to automate anyone's business process. We can view process …

Continue Reading...
How to enable opportunity splits in salesforce

Opportunity splits allows sales representatives to divide credit and revenue on any sales deal. If your sales process splits revenue from closed-won deals to give …

Continue Reading...
How to convert a web page into PDF format using renderAs attribute

Companies frequently need web page data to be converted into pdf. So, they can have an easy look into the progress. For this in salesforce …

Continue Reading...

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties