Search code examples
salesforcesoqlforce.com

I use the SELECT query to download contacts from Salesforce.com. As it is given below and i am getting "MALFORMED_QUERY" exception


I use this select query and i am not getting what's the wrong with this.

Select Id,Contact.FirstName,Contact.LastName,Contact.Title,Contact.Department,Contact.Birthdate, Contact.Phone,Contact.HomePhone,Contact.MobilePhone,Contact.OtherPhone,Contact.Fax,Contact.Email,Contact.MailingStreet, Contact.MailingCity,Contact.MailingState,Contact.MailingCountry,Contact.MailingPostalCode,Contact.OtherStreet, Contact.OtherCity,Contact.OtherState,Contact.OtherCountry,Contact.OtherPostalCode,Contact.Description,Contact.Account.Name From Contact where strcmp('%@',Id) = -1",lastcontactId


Solution

  • You need to generate a query that uses =, e.g.

    select name from contact where id='005123123123123123'
    

    so, you can use this to generate the query.

    NSString *query = [NSString stringWithFormat:@"select name,etc from contact where id='%@'", lastContactId];
    

    Here's the SOQL docs which has more examples.

    And if you're trying to do paging, you should just run the entire query and use query/queryMore to page through the results.