I am using a standard page on which there is a button in which JavaScript code is written. It is calling a Controller (Class).
When I ever used click on the button,It gives me error:
A problem with the OnClickJavaScriptforthis button or link was encountered:
unterminated string literal.
Javascript:
try
{
alert('hi1');
}
catch(Err)
{
alert('Error in creation'+Err);
}
After searching and done some hit and trial,used a simple alert code above.
I found that. whenever i used data where there is a new line space between them i.e. data in multiple times.This error encounters no matter if you are using that particular field in JavaScript code and class or not.
What i am trying to say is : i am not using that field anywhere in the JavaScript code. I am just simply using alert('hi');.
Nothing else you can also try just create a custom button on sfdc detail page ,call JavaScript on it and put data in any Long text area field with multiple line.You will get same error. Any work around for this?