You need to sign in to do that
Don't have an account?

How to query Contact name with apostrophe in soql?
Hi,
I have a situation where we have contact name's with characters such as an apostrophe in the Name field. What is the best way to still query the contact's name that contain an apostrophe?
Example scenario:
The current error message: uncaught exception malformed query
I have a situation where we have contact name's with characters such as an apostrophe in the Name field. What is the best way to still query the contact's name that contain an apostrophe?
Example scenario:
- Contact.Name = "John D'oe";
- Contact.Name = "John O'doe'
//assume it is a single contact String nm = contact.Name; Select Id, Name From Contact Where Name =: nm;
The current error message: uncaught exception malformed query
Try using string method String.escapeSingleQuotes()
All Answers
Try using string method String.escapeSingleQuotes()