Retrieving Multiple Requests

The RetrieveMultiple operation provides more capabilities to select data from Microsoft Dynamics CRM. The following types of RetrieveMultiple operations can be configured:

The condition operator, Like, allows you to perform pattern matching.

You can choose from the following patterns:

The following example shows the use of a percent character (%) wildcard:

<Condition>
    <AttributeName>name</AttributeName>
    <Operator>Like</Operator>
    <Values>
        <Value>My%</Value>
    </Values>
</Condition>

The result returns all entities whose name begins with My.

The following example shows the use of an underscore character (_) wildcard:

<Condition>
    <AttributeName>name</AttributeName>|
    <Operator>Like</Operator>
    <Values>
        <Value>My_ccount1</Value>
    </Values>
</Condition>

The result returns the entity whose name is 10 characters long, where the first two characters are My, and the last seven characters is ccount1.

The following is an example of a condition by multiple fields.

<Criteria>
    <Conditions>
        <ConditionExpression>
            <AttributeName>name</AttributeName>
            <Operator>Equal</Operator>
            <Values>
                <Value>Some Account</Value>
            </Values>
        </ConditionExpression>
    </Conditions>
    <FilterOperator>And</FilterOperator>
    <Filters>
        <is:FilterExpression>
            <is:Conditions>
                <is:ConditionExpression>
                    <is:AttributeName>accountnumber</is:AttributeName>
                    <is:Operator>Equal</is:Operator>
                    <is:Values>
                        <is:Value>2</is:Value>
                    </is:Values>
                </is:ConditionExpression>
            </is:Conditions>
            <is:FilterOperator>And</is:FilterOperator>
        </is:FilterExpression>
    </Filters>
</Criteria>

FilterExpression can also contain other filter expressions. It allows the creation of very complex and powerful conditions.

The RetrieveMultiple request contains the following parameters:

Parameter

Description

Operation

ColumnSet

This defines the attributes, which are included in the response document. All the existing attributes will be returned by MS CRM in an instance document, when this element is skipped.

All

LinkEntities

This defines the filtering of records in a response document by the values of attributes of some related entities.

All

NoLock

This retrieves or sets a value that indicates that no shared locks are issued against the data that would prohibit other transactions from modifying the data in the records returned from the query.

All

Distinct

This retrieves or sets whether the results of the query contain duplicate entity instances.

SelectAll, SelectByCondition

Orders

This is the order in which the entity instances are returned from the query.

SelectAll, SelectByCondition

PageInfo

This retrieves or sets the number of pages and the number of entity instances per page returned from the query. The response contains related information, including the total record count (if requested) and paging cookie (a string generated from requested paging criteria that may be used in the next requests to fasten data retrieval).

Select All, SelectByCondition

Note: Use paging if you expect large datasets to be returned. Large amounts of data may cause excessive memory consumption in the adapter, and cause errors or exceptions to be generated. Try to restrict the returned data with more precise selections and retry the request.