3

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

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

or

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

7
  • Have you had a look at the sample docs - might be a case of escaping a special char. salesforce.com/us/developer/docs/api/Content/… Oct 17, 2012 at 13:01
  • Can you post exactly what you have in the C# app?
    – Mike Chale
    Oct 17, 2012 at 13:05
  • my first idea would be to try replacing % by %25, but that could also be way off. Oct 17, 2012 at 13:13
  • string soql = "SELECT Id FROM Event WHERE (Subject LIKE 'Order%Created')"; SalesForceWS.SearchResult results = Binding.search(soql); Oct 17, 2012 at 13:48
  • @techtrekker - yes I have already seen that documentation and I have several other SOQL queries working just fine - it's only the LIKE operator that seems to be problematic. Oct 17, 2012 at 13:52

2 Answers 2

2

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.

0
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.