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
shunshun 

Strange problem querying for Lead by Company returns no results

Hi,

There seems to be a problem when querying for leads by Company.  The same query searching by LastName, Phone or even the custom field SicCode__c works, but the query by Company returns no results.

Below is the query request by Company which returns no results.

POST /services/Soap/u/3.0 HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: na1-api.salesforce.com
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 999

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="SforceService">
   <ns2:sessionId xmlns:ns2="urn:partner.soap.sforce.com">[Omit]</ns2:sessionId>
  </ns1:SessionHeader>
  <ns3:QueryOptions soapenv:mustUnderstand="0" xmlns:ns3="SoapService">
   <ns4:batchSize xmlns:ns4="urn:partner.soap.sforce.com">20</ns4:batchSize>
  </ns3:QueryOptions>
 </soapenv:Header>
 <soapenv:Body>
  <query xmlns="urn:partner.soap.sforce.com">
   <queryString>select ConvertedAccountId,ConvertedContactId,ConvertedOpportunityId,FirstName,LastName,Company,Phone,Id,SystemModstamp from Lead where Company like &apos;%Point%&apos;</queryString>
  </query>
 </soapenv:Body>
</soapenv:Envelope>


And below is the same request but by LastName and the query result is shown right afterwards.

POST /services/Soap/u/3.0 HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: na1-api.salesforce.com
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 999

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header>
  <ns1:SessionHeader soapenv:mustUnderstand="0" xmlns:ns1="SforceService">
   <ns2:sessionId xmlns:ns2="urn:partner.soap.sforce.com">[Omit]</ns2:sessionId>
  </ns1:SessionHeader>
  <ns3:QueryOptions soapenv:mustUnderstand="0" xmlns:ns3="SoapService">
   <ns4:batchSize xmlns:ns4="urn:partner.soap.sforce.com">20</ns4:batchSize>
  </ns3:QueryOptions>
 </soapenv:Header>
 <soapenv:Body>
  <query xmlns="urn:partner.soap.sforce.com">
   <queryString>select ConvertedAccountId,ConvertedContactId,ConvertedOpportunityId,FirstName,LastName,Company,Phone,Id,SystemModstamp from Lead where LastName like &apos;%Akin%&apos;</queryString>
  </query>
 </soapenv:Body>
</soapenv:Envelope>

Query results:

HTTP/1.0 200 OK

Server: sfdc

Server: sfdc

Content-Type: text/xml; charset=utf-8

Date: Mon, 19 Apr 2004 16:25:25 GMT

 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <queryResponse xmlns="urn:partner.soap.sforce.com">
   <result>
    <done>true</done>
    <queryLocator xsi:nil="true"/>
    <records xsi:type="sf:sObject" xmlns:sf="urn:sobject.partner.soap.sforce.com">
     <sf:type>Lead</sf:type>
     <sf:Id>00Q300000013bXLEAY</sf:Id>
     <sf:ConvertedAccountId xsi:nil="true"/>
     <sf:ConvertedContactId xsi:nil="true"/>
     <sf:ConvertedOpportunityId xsi:nil="true"/>
     <sf:FirstName>TKristen</sf:FirstName>
     <sf:LastName>Akin</sf:LastName>
     <sf:Company>GenePoint</sf:Company>
     <sfhone>(434) 369-3100</sfhone>
     <sf:Id>00Q300000013bXLEAY</sf:Id>
     <sf:SystemModstamp>2004-04-19T15:50:07.000Z</sf:SystemModstamp>
    </records>
    <size>1</size>
   </result>
  </queryResponse>
 </soapenv:Body>
</soapenv:Envelope>

DevAngelDevAngel

Hi shun,

This looks like a bug on the Lead object/SOQL processing.  I have filed it as such and we will resolve the issue and publish a fix as soon as possible.

Cheers