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
tulasiram chtulasiram ch 

categories in custom labels

Can any one help me how to use CATEGORIES in CUSTOM LABELS...Tell me how it can be used in our code with example...I am learning salesforce...thank you
Tarun J.Tarun J.
Hello Tulasiram,

You can use Category in filter criteria when creating custom label list views. This will help to classified label for various funtionalities.

-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
NagendraNagendra (Salesforce Developers) 
Hi Tulsiram,

Categories are a comma-separated list of categories for the label. This field can be used in filter criteria when creating custom label list views. Maximum of 255 characters.

In the below example let us see how we can access the custom label in the apex. Let's assume we have created a custom label of name category with a value "A Custom Label Value"

Visual Force Page:
<apex:page controller="custlabelcontroller">
   <apex:form >
     <apex:pageblock >
       Value stored in custom label is: {!customValue}
     </apex:pageblock>
   </apex:form>
</apex:page>
Apex Controller Page:
Public class custlabelcontroller{
Public string customValue{get;set;}
  Public custlabelcontroller(){
   customValue = Label.category;
  }
}
Below is the output of the following.
User-added imageHope this helps.

Regards,
Nagendra.

 
tulasiram chtulasiram ch
Thank you for your answers: categories are comma seperated values ok, i understood that but how can we create a list of labels with comma seperated values using categories . If you observe below pic what is categories field and how we can declare it and how can we call it from vf or apex.
User-added image.  
Tarun J.Tarun J.
You can filter using Categories by providing multiple values separated by comma.
User-added image

In above screen shot, I am creating a list view which will show labels which belongs to 'Component' and 'Pages' categories. You can use multiple Categories separated by comma in list view filter like this.

-Thanks,
TK
 
tulasiram chtulasiram ch
Hi Tk, can you tell me how can we use these category label in Apex. 
Like
string value = label.customLabelName;
Tarun J.Tarun J.
Category is separate and Label value is separate.

1. You can use Category in filter criteria when creating custom label list views.
2. Label value is being used in Code as below:
a. Apex Class: System.Label.<Label Name>
b. VF Page: {!$Label.<Label Name>}

-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.