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
Suresh RaghuramSuresh Raghuram 

Issue wiht passing Sting as a query

Hi Community,

 

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

purupuru

Hi,

 

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 ';

 

Regards,

Purushottam

Purushottam Bhaigade Software Developer, Screen-Magic
purushottambhaigade@gmail.com | www.screen-magic.com

 

Facebook Twitter LinkedIn
Contact me: Skype purushottam8688

 

Suresh RaghuramSuresh Raghuram
ya i removed the + in StageName Like \'Closed%' it is working fine thanks for the suggestion