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
MNCGuntaka GMNCGuntaka G 

Error: Compile Error: line breaks not allowed in string literals

'Functionality-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don't see INDS Site)',
'Login-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don't see INDS Site)',
'Training-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don't see INDS Site)',
'Infrastructure-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don't see INDS Site)',}
for (Case c : Trigger.new){
        if(c.Vamshi_Product__c!= null){
            c.Issue_Category__c  = myPickListMap.get(c.Vamshi_Product__c);
        }
    }
Help me to solve this error and where i went wrong writing the code.

Thanks,
Nikhil
 
GauravGargGauravGarg
Hi Guntaka,

Your string is breaking in between "don't", this need to be handled with escape characters. Please use below code:
'Functionality-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',
'Login-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',
'Training-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',
'Infrastructure-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',}
for (Case c : Trigger.new){
        if(c.Vamshi_Product__c!= null){
            c.Issue_Category__c  = myPickListMap.get(c.Vamshi_Product__c);
        }
    }

Please try with this code, and let me know if you still face issues. 

Thanks,
Gaurav
Skype: gaurav62990

 
rsfdc77rsfdc77
Hi MNCGuntaka G ,
Generally we use single quotes for a string but when we want to use apostrophe in between the string, we should use back slash before that apostrophe symbol to indicate that apostrophe is also a part of the string and  one more error is , in the 4th line before the closing curly bracket  comma ('' , ") is not required. So replace your lines with the following

'Functionality-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',

'Login-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',

'Training-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)',

'Infrastructure-nw'=>'Websites: jepp Direct, Jeppesen, INDS Site, myJepp (don\'t see INDS Site)'};


Please mark it , if it solves your issue.
 
MNCGuntaka GMNCGuntaka G
Thank you Gaurav and RSFDC77 for the explanation. I will make the changes and let you both know the result.

Regards,
Nikhil