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
TheLearnerTheLearner 

Amending the custom label in the apex class

Hi Experts,

I need to add custom label in the below code, could anyone tell me how to use it, because, its heierachy kind links are there so how to add could anyone help me please.

Current_User_Email__c from SW_Notice__c where id =: System.currentPageReference().getParameters().get('id') ];
        String [] toAddresses;
       if(notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c!=null){ //CH01
            toAddresses = new String[] {notices[0].Current_User_Email__c , notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c,'test@test.com'}; //CH01
            //toAddresses = new String[] {notices[0].Current_User_Email__c , notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c,'test@test.in'};  //CH01
        }else{  
            toAddresses = new String[] {notices[0].Current_User_Email__c,'test@test.com'};  
            //toAddresses = new String[] {notices[0].Current_User_Email__c,'test@test.in' }; 
        } 
ManojjenaManojjena
Hi ,
You can create a custom level and access it in apex like below .

System.Label.LabelName   which will return you a string .

Thanks
Manoj
TheLearnerTheLearner
HI Manoj,

Thanks for ur reply , im not able to understand how to use in these lines.

if(notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c!=null){ //CH01
            toAddresses = new String[] {notices[0].Current_User_Email__c , notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c,'test@test.com'}; //CH01
            //toAddresses = new String[] {notices[0].Current_User_Email__c , notices[0].SW_Street_Project_Name__r.Project_Ref__r.Project_Manager__r.Email__c,'test@test.in'};  //CH01