Find your content:

Search form

You are here

MALFORMED_SEARCH error with SOQL query in C# application


when I run this SOQL query via the Developer Console it works...

SELECT Id FROM Event WHERE Subject LIKE 'Order%Created'


SELECT Id FROM Event WHERE (Subject LIKE 'Order%Created')

But when I put this query into my C# application I get a "MALFORMED_SEARCH: No search term found. The search term must be enclosed in braces."

I've tried everything I can think of and reviewed all the available documentation that I could track down to no avail... What exactly is the SalesForce API expecting in this case?? remove signature

Attribution to: James Colyer

Possible Suggestion/Solution #1

You haven't posted your code, but based on the error message it sounds like you're passing your SOQL query to the search function, when you should be passing it to the query function.

Attribution to: superfell

Possible Suggestion/Solution #2

I just quickly imported the Enterprise WSDL into VisualStudio and fired a SOQL Query on Contact with a LIKE, and it seemed to work okay. Here is the code below. I didn't need any special escaping for the %

String soqlQuery = "SELECT FirstName, LastName FROM Contact where LastName like 'Black%'";

  SforceService binding = new SforceService();
  LoginResult  lr = binding.login(username, password);
  binding.Url = lr.serverUrl;

  binding.SessionHeaderValue = new SessionHeader();

  binding.SessionHeaderValue.sessionId = lr.sessionId;

 QueryResult qr = binding.query(soqlQuery);

Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content