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
theCodeJugglertheCodeJuggler 

Single quote broken in PickLists for SOQL?

If a picklist has a single-quote in it, like:

 

   Said 'hi!'

 

It appears we should create SOQL to query this like:

 

     select FirstName, Email from Contact where LeadSource = 'Said \'hi!\''

 

This executes without error, but generates zero rows, even though I set the LeadSource for a contact to have this value.  Is this a Salesforce bug, or should the SOQL be formatted differently?

 

Thanks

crmninjacrmninja
You have an error up there, correct?  Your first value has two quotation marks, one before and after; you're soql phrase looks like it's designed with only one.