I am trying to do a RetrieveMultiple, with either a QueryByAttribute
or a QueryByExpression in both cases I appear to get back no records.
If i do a QueryByExpression, but don't supply any Criteria\Conditions
then it appears to work as expected giving my records, as soon as I
add one or more condition elements i get back nothing. I tried the
same thing with QueryByAttribute but you have to supply at least one
attribute when going this route.
See below for an example of the xml from my map with condition
elements and the associated response I receive; and then see also
below for a sample of the xml from my map where I do not include any
condition elements and its associated response.
Can you spot anything that I am doing wrong?
Logic says it must have something to do with the condition elements
because the same request without any conditions returns data; but i
have no idea what ... all seems good to me.
withcondition_request:
-------------------------------------
<ns0:RetrieveMultipleRequest ReturnDynamicEntities="false"
crm_action="execute" xmlns:ns1="http://schemas.microsoft.com/crm/2006/
CoreTypes" xmlns:ns2="http://microsoft.com/wsdl/types/"
xmlns:ns3="http://schemas.microsoft.com/crm/2006/WebServices"
xmlns:ns4="http://schemas.microsoft.com/crm/2006/Query"
xmlns:ns0="http://crm.i5.co.za/schemas.microsoft.com/crm/2006/
RetrieveMultipleRequest" xmlns:ns5="http://schemas.microsoft.com/crm/
2006/Scheduling" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
<Query xsi:type="ns4:QueryExpression">
<ns4:EntityName>contact</ns4:EntityName>
<ns4:ColumnSet xsi:type="ns4:ColumnSet">
<ns4:Attributes>
<ns4:Attribute>fullname</ns4:Attribute>
</ns4:Attributes>
</ns4:ColumnSet>
<ns4:Distinct>true</ns4:Distinct>
<ns4:PageInfo>
<ns4:PageNumber>1</ns4:PageNumber>
<ns4:Count>10</ns4:Count>
</ns4:PageInfo>
<ns4:Criteria>
<ns4:FilterOperator>And</ns4:FilterOperator>
<ns4:Conditions>
<ns4:Condition>
<ns4:AttributeName>fullname</ns4:AttributeName>
<ns4:Operator>Like</ns4:Operator>
<ns4:Values>
<ns4:Value>%</ns4:Value>
</ns4:Values>
</ns4:Condition>
</ns4:Conditions>
</ns4:Criteria>
</Query>
</ns0:RetrieveMultipleRequest>
withcondition_response:
-------------------------------------
<ns0:Response xmlns:ns0="http://schemas.microsoft.com/crm/
BizTalkAdapter/Response">
<Header>
<ReturnCode>1</ReturnCode><ErrorCode></ErrorCode><ErrorString></
ErrorString><Retryable></Retryable>
</Header>
<Body>
<Message><prefix:RetrieveMultipleResponse
xmlns:prefix="..."><BusinessEntityCollection
EntityName="contact" MoreRecords="false"
PagingCookie=""><BusinessEntities xmlns="http://
schemas.microsoft.com/crm/2006/WebServices" /></
BusinessEntityCollection></prefix:RetrieveMultipleResponse></
Message>
</Body>
</ns0:Response>
withoutcondition_request:
---------------------------------------
<ns0:RetrieveMultipleRequest ReturnDynamicEntities="false"
crm_action="execute" xmlns:ns1="http://schemas.microsoft.com/crm/2006/
CoreTypes" xmlns:ns2="http://microsoft.com/wsdl/types/"
xmlns:ns3="http://schemas.microsoft.com/crm/2006/WebServices"
xmlns:ns4="http://schemas.microsoft.com/crm/2006/Query"
xmlns:ns0="http://crm.i5.co.za/schemas.microsoft.com/crm/2006/
RetrieveMultipleRequest" xmlns:ns5="http://schemas.microsoft.com/crm/
2006/Scheduling" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
<Query xsi:type="ns4:QueryExpression">
<ns4:EntityName>contact</ns4:EntityName>
<ns4:ColumnSet xsi:type="ns4:ColumnSet">
<ns4:Attributes>
<ns4:Attribute>fullname</ns4:Attribute>
</ns4:Attributes>
</ns4:ColumnSet>
<ns4:Distinct>true</ns4:Distinct>
<ns4:PageInfo>
<ns4:PageNumber>1</ns4:PageNumber>
<ns4:Count>10</ns4:Count>
</ns4:PageInfo>
</Query>
</ns0:RetrieveMultipleRequest>
withoutcondition_response:
----------------------------------------
<ns0:Response xmlns:ns0="http://schemas.microsoft.com/crm/
BizTalkAdapter/Response">
<Header>
<ReturnCode>1</ReturnCode><ErrorCode></ErrorCode><ErrorString></
ErrorString><Retryable></Retryable>
</Header>
<Body>
<Message><prefix:RetrieveMultipleResponse
xmlns:prefix="..."><BusinessEntityCollection
EntityName="contact" MoreRecords="true" PagingCookie="&lt;cookie
page=&quot;1&quot;&gt;&lt;contactid last=&quot;
{C6BCDE1E-5960-DC11-84AC-000E0CAAE3B7}&quot; first=&quot;
{78D040BB-C14F-DB11-8178-000E0CAAE3B7}&quot; /&gt;&lt;/
cookie&gt;"><BusinessEntities xmlns="http://
schemas.microsoft.com/crm/2006/WebServices"><BusinessEntity
xsi:type="contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"><contactid>78d040bb-c14f-db11-8178-000e0caae3b7</
contactid><fullname>Blah....
<shortened for brevity sakes>
><BusinessEntity xsi:type="contact" xmlns:xsi="http://www.w3.org/
2001/XMLSchema-instance"><contactid>c6bcde1e-5960-
dc11-84ac-000e0caae3b7</contactid><fullname>Blah</
fullname></BusinessEntity></BusinessEntities></
BusinessEntityCollection></prefix:RetrieveMultipleResponse></
Message>
</Body>
</ns0:Response>