In this blog, we will learn how to set up Service Appointments and assign them to the right people to get the job done.
Custom labels can be created from the setup page and apex code.
Go to setup → Search for Custom Labels and Select Custom Labels.
Click the New Custom Label button. Fill in the Label Name, and value details and Click Save.
Open the newly created label and click “New” in the Translation section. Select language, add translation value, and save.
Custom Labels are records of the standard object called External String and translations are stored in its child object named externalStringLocalisation. Both can be accessed from the Tooling API.
URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v57.0/tooling/sobjects/ExternalString'
Sample Request Body:
- {
- "Name" : "Welcome",
- "MasterLabel" : "Welcome",
- "Value" : "Welcome",
- "IsProtected" : false,
- "Category" : null,
- "Language" : "en_US"
- }
Sample Response Body:
- response.getBody() will return the following response with custom label Id.
- {
- "id" : "xxxxxxxxxxxxxxxxx",
- "success" : true,
- "errors" : [ ],
- "warnings" : [ ],
- "infos" : [ ]
- }
URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v57.0/tooling/sobjects/ExternalStringLocalization’
Sample Request Body
- {
- "ExternalStringId" : "xxxxxxxxxxxxxxxxx",
- "Value" : "Willkommen",
- "Language" : "de"
- }
Another salesforce standard Functionality Translation workbench can be used for providing translations for Custom fields, Actions, Lightning page Tabs, Picklist values, etc...
Now you have learned about how to create custom labels. Use the link below to Know about next step of How to import custom labels in Lightning web components