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
Anji P 9Anji P 9 

String s='select id,createddate,stagename from opportunity where stagename=\'Closed Won'/ and createddate=TODAY' but i'm getting error like semicolon missing pl any one help me out how to solve this

Best Answer chosen by Anji P 9
sfdcMonkey.comsfdcMonkey.com
HI Anji,

you got this error because of you are using the forward slash (/) after single qoutes, you need to use back salash (\) before single quotes to skip the extra single quotes in string.  use below statement.
 
String s ='select id,createddate,stagename from opportunity where stagename=\'Closed Won\' and createddate=TODAY' ;

i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks, sfdcmonkey.com  
    

All Answers

Aparna Hegde 1Aparna Hegde 1
Hi Anji P 9,
May be try
string StgName = 'Closed Won';
string s='select id,createddate,stagename from opportunity where stagename=:Stgname and createddate=TODAY'

Cheers,
Aparna
sfdcMonkey.comsfdcMonkey.com
HI Anji,

you got this error because of you are using the forward slash (/) after single qoutes, you need to use back salash (\) before single quotes to skip the extra single quotes in string.  use below statement.
 
String s ='select id,createddate,stagename from opportunity where stagename=\'Closed Won\' and createddate=TODAY' ;

i hope it helps you.
      Let me inform if it helps you and kindly mark it best answer if it helps you so it make proper solution for others
thanks, sfdcmonkey.com  
    
This was selected as the best answer