+ Start a Discussion
developer_forcedeveloper_force 

error: line breaks not allowed in string literals

PageReference p = new PageReference('/00OM0000000SNVS+?pv0=’+ stringUrl);

 

the error says "line breaks not allowed in string literals at line 17 column -1"

 

Can anyone pls help to fix thsi error

 

Thanks

Baktash H.Baktash H.

i have copied and pasted your code in my eclipse and it says the same.

you have used the wrong quotes.

 

PageReference p = new PageReference('/00OM0000000SNVS+?pv0='+ stringUrl);

Take this or try again with right quotes.

TechSteveTechSteve

Hi, i'm assuming /00OM0000000SNVS is a record id and you want to add information to the url.

If so you don't need the + infront of the ?. So it should look like:

 

                    PageReference p = new PageReference('/00OM0000000SNVS?pv0=' + stringUrl);

 

Dont forget if you are referencing a vf page created with the apex editor you need to put /apex/ then you page name.