- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
01-03-2013 07:57 AM
I am passing string as a query
String query = 'SELECT ID,Principal_Owner__c, StageName, Last_Campaign_Before_Close__c from opportunity where Id =\'006E00000056kIw\'';
The above part is working fine .
The problem is when i add the below part it is working .
//and StageName LIKE \'+Closed%\'';
Colud any suggest me where iam doing wrong
01-03-2013 11:51 PM
Can you please write your whole query string.
I guess according to this post in your and part i.e. "and StageName LIKE \'+Closed%\''" here you are using Closed as variable and you had appended the "%" at the end of closed. What I will suggest you to try query in below way.
String stageName = "Closed%";
String query = 'SELECT ID,Principal_Owner__c, StageName, Last_Campaign_Before_Close__c from opportunity where Id =\'006E00000056kIw\' and StageName LIKE :stageName ';