Oracle Web Services On Demand Guide > Web Services On Demand API Calls > Web Services v2.0 API Calls >

QueryPage


Executes a query against the set of records for an object, and returns the subset of the records that match the search criteria set by the method arguments.

NOTE:  For fields of all data types apart from xsd:string, if the field has a blank or no value, it does not appear in the query response.

Team and Role Visibility Considerations

If a query includes a child object for which the user does not have access due to team or role visibility, then the child object returns no records.

Query by Template

To improve performance, the QueryPage result contains only those fields and objects that are included in the QueryPage request. To retrieve the values of fields that are not a part of the search criteria, the field must be included in the search request with a blank value.

Using the pagesize, startrownum, and recordcountneeded Arguments

The pagesize argument, which has a maximum value of 100, is used to specify the maximum number of records to be returned in a QueryPage response. The pagesize and startrownum arguments are specified as attributes of the ListOf(Object) element in requests, for example:

<ListOfAccount pagesize="20" startrownum="0" recordcountneeded="true">

Depending on the value of pagesize, records are returned as follows:

  • If the number of records in the record set is less than the pagesize value, the full record set is returned, and the lastpage attribute is set to true.
  • If the number of records in the record set exceeds the pagesize value, only the number of records specified by the pagesize parameter is returned, and the lastpage attribute is false.
  • For a query whose record set exceeds the pagesize value, setting the startrownum attribute to pagesize+1 (setting startrownum to pagesize returns the next pagesize number of records) returns the next pagesize number of records.
  • If the size of the record set is greater than pagesize, and this is a subsequent query where there are less than pagesize number of records remaining to be returned, all of the remaining records are returned and lastpage attribute has a value of true.

Even though the QueryPage method returns a limited number of records, it keeps the data in the cache, which you can then retrieve by calling the QueryPage method again with a new value for the startrownum argument.

If you set the recordcountneeded argument to true, the record count is returned, except when the search specification includes calculated fields:

  • If the QueryPage request contains filter criteria on a calculated field, or a calculated field is part of the value of the searchspec attribute, and there are records that match the given filter criteria, an error is thrown.
  • If the QueryPage request contains filter criteria on a calculated field, or a calculated field is part of the value of the searchspec attribute, and there are no records that match the filter criteria (recordcount = "0" returned), no error is thrown.

NOTE:  There is a performance impact if recordcountneeded is set to true, especially if the search specification contains calculated fields.

Using Search Specifications

You can use the searchspec argument of QueryPage to return only those records matching specified search criteria for an object. You can also specify the sort order and sort sequence for returned records using the sortorder and sortsequence arguments respectively. For more information, see Specifying the Sort Order and Sort Sequence.

The searchspec argument is specified as an attribute of an Object element in requests, for example:

<Contact searchspec="[ContactFirstName] = 'Jo*'">

which would return only contact records for which the ContactFirstName field value begins with Jo. The search specification can be set on any field type. The query syntax is described in the following topic.

TIP:   It is recommended to use a stateful rather than a stateless QueryPage Web service request, if it is required to paginate through a snapshot of data. However, if you do use a stateless request, it is recommended to use sort criteria to reduce the possibility of returning the same record when paging through results using the QueryPage method. For more information, see Use Sort Criteria when Using QueryPage.

Query Syntax

The query syntax for the searchspec argument supports only a small subset of binary and unary operators. No Siebel Query Language constructs or functions are supported. The query syntax is summarized in Table 34.

Table 34. Query Syntax for QueryPage
Syntax Type
Notes

expression

[XML Tag] {Operator} {Value}

Operator can be binary or unary. The {Value} need only be specified for binary operators.

(expression) conjunction (expression)

A conjugated expression must be enclosed in parentheses to avoid ambiguity. However, nonconjugated expressions must not be enclosed in parentheses.

conjunction

OR

None

AND

None

unary operator

 

IS NULL

Used to find a match for a value that has no value

IS NOT NULL

None

EXISTS

See The EXISTS and NOT EXISTS Operators

NOT EXISTS

None

binary operator

=

None

~=

Denotes a case-insensitive exact search (no wildcards used)

<

Must be specified as &lt; to ensure well-formed XML.

<=

Must be specified as &lt;=

>

None

>=

None

<>

Must be specified as &lt;>

LIKE

Wildcard characters are treated as such only in the context of the operator LIKE.

~LIKE

Denotes a case-insensitive wildcard search

value

'literal'

Literal data is always enclosed in single quotes.

To use a single quote within a literal, place another single quote immediately beside that quote. In this way, the query recognizes the quote as a literal and not as an operator. For example, the string ab'c is specified as ab''c.

To use the special characters such as asterisk (*), question mark (?), and backslash (\) in queries, preceded them with the \ character. For example, to use the ? wildcard operator in a query, precede it with the \ character as follows:

\?

CAUTION:  Queries that are case-insensitive or with leading wildcard characters will perform slowly and must only be used when necessary. In some cases, you can however use shadow fields, see Using Shadow Fields for Better Search Performance.

The following is an example from a request that follows the query syntax:

<Contact searchspec="[ContactFirstName] = 'John'">

where XML Tag is Contact FirstName, the operator is = and the value is the literal value John.

An example of an expression with a conjunction is as follows:

<Contact searchspec="([ContactFirstName] = 'Jane'") AND ([ContactLastName] = 'Doe'")>

Examples of searchspec usage are given in Table 35.

Table 35. Searchspec Examples
Operator
Usage of searchspec in request
Description

Case Sensitive LIKE with * wildcard

<ListOfContact startrownum="0" pagesize="100" recordcountneeded="true">
<Contact searchspec="[ContactFirstName] LIKE 'Contact*'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters

Case Insensitive ~ LIKE with * wildcard

<ListOfContact><Contact searchspec="[ContactFirstName] ~LIKE 'Contact*'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with, for example, "Contact" or "contact" or "CoNtAcT" and ends with zero or more characters

Case Sensitive LIKE with ? wildcard

<ListOfContact><Contact searchspec="[ContactFirstName] LIKE 'Contact???'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with any three characters

Case Insensitive ~ LIKE with ? wildcard

<ListOfContact><Contact searchspec="[ContactFirstName] ~LIKE 'Contact???'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with, for example, "Contact" or "contact" or "CoNtAcT", and ends with any three characters

Case Sensitive =

<ListOfContact><Contact searchspec="[ContactFirstName] = 'ContactInsert'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value is equal to "ContactInsert"

Case Insensitive ~=

<ListOfContact><Contact searchspec="[ContactFirstName] ~= 'ContactInsert'">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value is equal to, for example, "ContactInsert","contactinsert" or "CoNtAcTiNsErT"

IS NULL

<ListOfContact><Contact searchspec="[TEXTLG_000] IS NULL">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose TEXTLG_000 value is NULL

IS NOT NULL

<ListOfContact><Contact searchspec="[TEXTLG_000] IS NOT NULL">
<ContactFirstName/>
</Contact></ListOfContact>

Returns all contacts whose TEXTLG_000 value is not NULL

AND

<ListOfContact><Contact searchspec="[BOOL_000] = 'Y' AND [IndexedBoolean0] = 'N'">

<ContactFirstName/><IndexedBoolean0/>

</Contact></ListOfContact>

Or

<ListOfContact>

<Contact searchspec="[BOOL_000] = 'Y'">

<ContactFirstName/>

<IndexedBoolean0>='N'</IndexedBoolean0>

</Contact></ListOfContact>

Or

<ListOfContact><Contact>

<ContactFirstName/>

<BOOL_000>='Y'</BOOL_000>

<IndexedBoolean0>='N'</IndexedBoolean0>

</Contact></ListOfContact>

Returns all contacts whose BOOL_000 value is Y AND IndexedBoolean0 value is N

OR

<ListOfContact><Contact searchspec="[BOOL_000] = 'Y' OR [IndexedBoolean0] = 'N'">
<ContactFirstName/>
<BOOL_000/>
<IndexedBoolean0/>
</Contact></ListOfContact>

Returns all contacts whose BOOL_000 value is Y OR IndexedBoolean0 value is N

>

(greater than)

<ListOfContact><Contact searchspec="[IndexedNumber0] > '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact>

Returns all contacts whose IndexedNumber0 value is greater than 500

>=

(greater than or equal to)

<ListOfContact><Contact searchspec="[IndexedNumber0] >= '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact>

Returns all contacts whose IndexedNumber0 value is greater than or equal to 500

<

(less than)

<ListOfContact><Contact searchspec="[IndexedNumber0] < '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact>

Returns all contacts whose IndexedNumber0 value is less than 500

<=

(less than or equal to)

<ListOfContact><Contact searchspec="[IndexedNumber0] <= '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact>

Returns all contacts whose IndexedNumber0 value is less than or equal to 500

<>

(not equal to)

<ListOfContact><Contact searchspec="[IndexedNumber0] <> '500'">
<ContactFirstName/>
<IndexedNumber0/>
</Contact></ListOfContact>

Returns all contacts whose IndexedNumber0 value is not equal to 500

Using Shadow Fields for Better Search Performance

To provide better performance for case-insensitive wildcard searches, you can use shadow fields in search specifications for some record types. Shadow fields are predefined and are found in the WSDL file for each object for which they are supported.

Shadow fields add a suffix, _Shadow, to the actual field name. For example, for a Name field there would be a Name_Shadow field. Shadow fields always store their value in upper case, so, for example, if the Name field has the value Oracle, then the Name_Shadow field has the value ORACLE.

To perform case insensitive searches, you use the shadow field instead of the actual field. For example, instead of a searchspec like this:

searchspec="[Name] ~LIKE '%cle"

you can use the following searchspec including upper case characters for better performance:

searchspec="[Name_Shadow] LIKE '%CLE'"

The EXISTS and NOT EXISTS Operators

You can use the unary operators EXISTS and NOT EXISTS with the searchspec argument of the QueryPage operation for any multivalued field of objects supported for Web Services v2.0.

EXISTS and NOT EXISTS only work for multivalued fields and not on other fields, including multi-select picklists. Very few multivalued fields are available, but one example is the address fields on the Account and Contact parent objects. Multivalued fields contain data from multiple records, in the case of the address fields, multiple countries, counties, and so on.

EXISTS returns true if the field expression matches for at least one of the values of the multivalued field.

For example, to query for all contacts where any one of the values of the AlternateAddressExternalSystemId field for all associated addresses of Contact is XYZ:

<Contact searchspec="EXISTS ([AlternateAddressExternalSystemId] = 'XYZ')">

NOT EXISTS returns true if the field expression matches for none of the values of the multivalued field.

For example, to query for all contacts where none of the values of the AlternateAddressExternalSystemId field for all associated addresses of Contact is XYZ:

<Contact searchspec="NOT EXISTS ([AlternateAddressExternalSystemId] = 'XYZ')">

As another example, to query for all accounts where any one of the values of the PrimaryBillToCounty field is Suffolk and any one of the values of the Primary Bill To Street Address field contains Ipswich:

<Account searchspec="EXISTS ([PrimaryBillToCounty] = 'Suffolk' AND [PrimaryBillToStreetAddress] LIKE '%Ipswich%')

Specifying the Sort Order and Sort Sequence

You can specify the sort order and sort sequence for returned records using the sortorder and sortsequence arguments respectively.

The sortorder and sortsequence arguments are specified as attributes of a FieldName element in requests, for example:

<CampaignName sortorder="ASC" sortsequence="1"/>

which specifies that the records returned are sorted on the CampaignName field in an ascending order.

The sortsequence argument is used to specify the order in which sorting is applied if a sortorder value is specified on more than one field, for example:

<CampaignName sortorder="ASC" sortsequence="1"/>

<Status sortorder="ASC" sortsequence="2"/>"

Examples of sortorder and sortsequence usage are given in Table 36.

NOTE:  The sortorder argument is not supported for fields of date type CLOB or BLOB. Such fields could be used with the searchpsec argument with a LIKE operator, however, for performance reasons, use of CLOB and BLOB fields even for filtering must be avoided.

CAUTION:  Using multiple sort criteria might affect query performance. Use it only when necessary.

Table 36. Sortorder and sortsequence Examples
Sort type
Usage of sortoder and sortsequence
Description

Sort in ascending order

<ListOfContact startrownum="0" pagesize="100" recordcountneeded="true">
<Contact searchspec="[ContactFirstName] LIKE 'Contact*'">
<ContactLastName sortorder="ASC"></ContactLastName>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in ascending order

Sort in descending order

<ListOfContact startrownum="0" pagesize="100" recordcountneeded="true">
<Contact>
<ContactLastName sortorder="DESC">~LIKE 'Contact*'</ContactLastName>
</Contact></ListOfContact>

Returns all contacts whose ContactLastName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in descending order

Sort More than One Field

<ListOfContact startrownum="0" pagesize="100" recordcountneeded="true">
<Contact searchspec="[ContactFirstName] LIKE 'Contact*'">
<ContactLastName sortorder="DESC" sortsequence="1"></ContactLastName> <ContactFirstName sortorder="DESC" sortsequence="2"></ContactFirstName>
<ExternalSystemId sortorder="DESC" sortsequence="3"></ExternalSystemId>
</Contact></ListOfContact>

Returns all contacts whose ContactFirstName value starts with "Contact" and ends with zero or more characters and sorts them by ContactLastName in descending order and then by ContactFirstName in descending order and then by ExternalSystemId in descending order.

Specifying Books in Queries

For queries on record types that support books, you can use the BookId or BookName arguments to constrain the query to only the records in a particular book. For more information about the use of books, see Oracle CRM On Demand Online Help.

Querying Lists

You can use the optional NamedSearchSpec argument to query a list. NamedSearchSpec can specify the name of a System, Public or Private list, however, a user cannot specify the name of a list to which he or she does not have access in the UI.

The set of fields to be returned must be included in the SOAP request. The set of fields defined in the list as well as the sort order of the list are not used to define the response, however, the query uses the filter criteria defined in the UI for the list.

All languages are supported.

You can use NamedSearchSpec together with the searchspec argument to search within a list. In a QueryPage request when NamedSearchspec and field-level searchspecs are specified, an AND operation is performed between NamedSearchspec and the field-level searchspecs. For example, if the searchspec in a request is:

"[Field]=500"

and the value of NamedSearchSpec is:

([Field1] > 100 OR ([Field2] > 500 AND [Field 3] = true) AND [Field4] = 'MyName') AND [Field5] = 'Open'

then the effective searchspec is:

([Field]=500) AND (([Field1] > 100 OR ([Field2] > 500 AND [Field 3] = true) AND [Field4] = 'MyName') AND [Field5] = 'Open')

Specifying Proximity Search Parameters

In the Maps page in Oracle CRM On Demand you can perform a proximity search to check the addresses on records of a given record type to determine whether the addresses are within a specified radius of a selected location. Proximity searches are supported for the Account, Activity, and Contact record types. In the QueryPage methods for these record types, you must use the following arguments to specify the parameters for a proximity search:

  • Latitude. The latitude value of the proximity search center.
  • Longitude. The longitude value of the proximity search center.
  • Radius. The radius of the proximity search. Possible values are: 1,5,10,20,25.
  • Units. The unit of distance: Miles or Kilometers.
  • AddressType. For the Account record type only, the address type for the proximity search:
    • BillingAddress. The proximity search for the account is limited to the billing address.
    • ShippingAddress. The proximity search for the account is limited to the shipping address.

      If the AddressType parameter is not provided or is empty, the proximity search is limited to the shipping address.

The namedsearchspec argument is used to define lists of records on which proximity searches can be made. If the arguments are missing or incorrect, an error message is received.

For more information about proximity searching, see Oracle CRM On Demand Online Help.

Arguments

Table 37 describes the arguments taken by the QueryPage method.

Table 37. Arguments Taken by the QueryPage Method
Name
Description
Required
Default
I/O

ListOf(Object). For example, ListOfAccount

The list of object instances queried (input), and after query execution, the list of object instances returned (output).

Yes

Not applicable

Input/Output

pagesize

The maximum number of records displayed on a page following a query.

No

10

Input

startrownum

Indicates the row from which the QueryPage method starts to return records.

For example, if pagesize=100 and you want to return records 1-100, you set StartRowNum to 0. Then, if you want to return records 101-200, you set StartRowNum to 100, and run the query again. You continue doing this until the last page is returned. In this way, you can return all records for a particular query.

No

0

Input

recordcountneeded

Indicates whether a record count for the object is to be returned.

NOTE:  There is a performance impact if this argument is set to true. You cannot return a record count for requests in which the search specification contains calculated fields. For more information, see Using the pagesize, startrownum, and recordcountneeded Arguments.

No

false

Input

searchspec

Indicates the search specification for a field or for all the fields of an object.

No

Not applicable

Input

sortsequence

An integer value that determines the order of the sort specification.

No

Not applicable

Input

sortorder

Determines the sort order for the records returned by the query, either ASC for ascending or DESC for descending.

No

ASC

Input

NamedSearchSpec

Indicates the search specification for a named list for an object.

No

Not applicable

Input

LOVLanguageMode

The language mode for picklists, see The LOVLanguageMode Argument.

No

LIC

Input

ViewMode

Specifies the level of access to records specified in the method call, see The ViewMode Argument.

Yes

Broadest

Input

BookId

The book ID.

No

Not applicable

Input

BookName

The book name. This argument is ignored if a value for BookId is supplied.

No

Not applicable

Input

IncludeSubBooks

Whether subbooks are to be included.

No

False

Input

Return Value of the Call

An object or list of objects of the type on which the method was called, with attributes as follows:

  • LastPage. A Boolean value that indicates whether or not the last value in the query set has been returned.
  • recordcount. An integer value that indicates the record count for the object. This value is only returned when recordcountneeded=true in the SOAP request.

Sample SOAP Requests

This topic contains a number of sample SOAP requests and responses to illustrate the use of the QueryPage API.

Sample SOAP Request 1 - QueryPage with Field-level Filter

The following SOAP request queries for contact records that have a ContactType like 'Customer*'. It demonstrates the use of optional attributes at the List of objects level: pagesize, startrownum, and recordcountneeded, and the use of optional elements <ViewMode> and <LOVLanguageMode>.

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <soap:Header>

      <wsse:Security>

         <wsse:UsernameToken>

            <wsse:Username>%%USERNAME%%</wsse:Username>

            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%%PASSWORD%%</wsse:Password>

         </wsse:UsernameToken>

      </wsse:Security>

   </soap:Header>

   <soap:Body>

      <ContactQueryPage_Input xmlns="urn:crmondemand/ws/ecbs/contact/">

         <ViewMode>Personal</ViewMode>

         <LOVLanguageMode>LIC</LOVLanguageMode>

         <ListOfContact pagesize="100" startrownum="0" recordcountneeded="true">

            <Contact>

               <ContactFirstName/>

               <ContactLastName/>

               <ContactType>LIKE 'Customer*'</ContactType>

               <ContactEmail/>

               <ListOfActivity>

                  <Activity>

                     <Subject/>

                  </Activity>

               </ListOfActivity>

            </Contact>

         </ListOfContact>

      </ContactQueryPage_Input>

   </soap:Body>

</soap:Envelope>

Sample SOAP Response 1

The following SOAP response shows the list of 5 objects returned by SOAP request 1.

<?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <SOAP-ENV:Body>

      <ns:ContactQueryPage_Output xmlns:ns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact xmlns="urn:/crmondemand/xml/Contact/Data" recordcount="5" lastpage="true">

            <Contact>

               <ContactEmail></ContactEmail>

               <ContactFirstName>D</ContactFirstName>

               <ContactLastName>Dan</ContactLastName>

               <ContactType>Customer</ContactType>

               <ListOfActivity lastpage="true">

                  <Activity>

                     <Subject>Send D Dan welcome email</Subject>

                  </Activity>

               </ListOfActivity>

            </Contact>

            <Contact>

               <ContactEmail></ContactEmail>

               <ContactFirstName>L</ContactFirstName>

               <ContactLastName>Lak</ContactLastName>

               <ContactType>Customer</ContactType>

               <ListOfActivity lastpage="true">

                  <Activity>

                     <Subject>Send L Lak welcome email</Subject>

                  </Activity>

               </ListOfActivity>

            </Contact>

            <Contact>

               <ContactEmail></ContactEmail>

               <ContactFirstName>NewCon6</ContactFirstName>

               <ContactLastName>Con6</ContactLastName>

               <ContactType>Customer</ContactType>

               <ListOfActivity lastpage="true">

                  <Activity>

                     <Subject>Add activity to C Contacts</Subject>

                  </Activity>

               </ListOfActivity>

            </Contact>

            <Contact>

               <ContactEmail>n@l.com</ContactEmail>

               <ContactFirstName>Nathan</ContactFirstName>

               <ContactLastName>Lak</ContactLastName>

               <ContactType>Customer</ContactType>

               <ListOfActivity lastpage="true">

                  <Activity>

                     <Subject>Send Nathan Lak welcome email</Subject>

                  </Activity>

                  <Activity>

                     <Subject>Send Jordan Lak welcome email</Subject>

                  </Activity>

                  <Activity>

                     <Subject>Send J Lak welcome email</Subject>

                  </Activity>

                  <Activity>

                     <Subject>ActivityInsert Test R19</Subject>

                  </Activity>

                  <Activity>

                     <Subject>ActivityInsert Test R19 2</Subject>

                  </Activity>

                  <Activity>

                     <Subject>ActivityInsert Test R19 2</Subject>

                  </Activity>

               </ListOfActivity>

            </Contact>

            <Contact>

               <ContactEmail></ContactEmail>

               <ContactFirstName>NewCon5</ContactFirstName>

               <ContactLastName>NewCon5</ContactLastName>

               <ContactType>Customer</ContactType>

               <ListOfActivity lastpage="true"></ListOfActivity>

            </Contact>

         </ListOfContact>

      </ns:ContactQueryPage_Output>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Sample SOAP Request 2 - QueryPage with searchspec, sortsequence and sortorder Attributes

The following SOAP request queries for Contact records by specifying a search criterion with an OR conjunction in the searchspec attribute.

The samples also demonstrate use of the optional pagesize, startrownum, and recordcountneeded attributes at the <ListOfObject> level.

In SOAP request 2a, pagesize = 5 and startrownum = 0, this request returns the 5 records starting at row 0 (first record) that match the search criteria.

In SOAP request 2b, pagesize = 5 and startrownum = 5, this request returns the next 5 records starting at row 5 (sixth record) that match the search criteria.

In addition, the sample demonstrates the sortsequence and sortorder attributes at the element level to specify the sort order and sort sequence of the whole result set (including rows of records not returned due to the pagesize limit). Note that across both responses, (SOAP response 2a and SOAP response 2b), the records are sorted accordinh to the specified sort sequence and sort order.

Sample SOAP Request 2a

In this SOAP request, pagesize = 5 and startrownum = 0:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <soap:Header>

      <wsse:Security>

         <wsse:UsernameToken>

            <wsse:Username>%%USERNAME%%</wsse:Username>

            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%%PASSWORD%%</wsse:Password>

         </wsse:UsernameToken>

      </wsse:Security>

   </soap:Header>

   <soap:Body>

      <ContactQueryPage_Input xmlns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact pagesize="5" startrownum="0" recordcountneeded="true">

            <Contact searchspec="[ContactLastName] LIKE 'C*' OR [ContactType] = 'Customer'">

               <ContactFirstName></ContactFirstName>

               <ContactLastName sortorder="DESC" sortsequence="2"></ContactLastName>

               <ContactType sortorder="DESC" sortsequence="1"></ContactType>

            </Contact>

         </ListOfContact>

      </ContactQueryPage_Input>

   </soap:Body>

</soap:Envelope>

Sample SOAP Response 2a

The following SOAP response shows the list of 5 objects returned by SOAP request 2a:

<?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <SOAP-ENV:Body>

      <ns:ContactQueryPage_Output xmlns:ns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact xmlns="urn:/crmondemand/xml/Contact/Data" recordcount="54" lastpage="false">

            <Contact>

               <ContactFirstName>James</ContactFirstName>

               <ContactLastName>Conners</ContactLastName>

               <ContactType>Prospect</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Ruth</ContactFirstName>

               <ContactLastName>Chou</ContactLastName>

               <ContactType>Prospect</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Jason</ContactFirstName>

               <ContactLastName>Cheney</ContactLastName>

               <ContactType>Prospect</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Sean</ContactFirstName>

               <ContactLastName>Thomas</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Carlos</ContactFirstName>

               <ContactLastName>Santos</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

         </ListOfContact>

      </ns:ContactQueryPage_Output>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Sample SOAP Request 2b

In this SOAP request, pagesize = 5 and startrownum = 5

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <soap:Header>

      <wsse:Security>

         <wsse:UsernameToken>

            <wsse:Username>%%USERNAME%%</wsse:Username>

            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%%PASSWORD%%</wsse:Password>

         </wsse:UsernameToken>

      </wsse:Security>

   </soap:Header>

   <soap:Body>

      <ContactQueryPage_Input xmlns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact pagesize="5" startrownum="5" recordcountneeded="true">

            <Contact searchspec="[ContactLastName] LIKE 'C*' OR [ContactType] = 'Customer'">

               <ContactFirstName></ContactFirstName>

               <ContactLastName sortorder="DESC" sortsequence="2"></ContactLastName>

               <ContactType sortorder="DESC" sortsequence="1"></ContactType>

            </Contact>

         </ListOfContact>

      </ContactQueryPage_Input>

   </soap:Body>

</soap:Envelope>

Sample SOAP Response 2b

The following SOAP response shows the list of 5 objects returned by the request in SOAP request 2b:

<?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <SOAP-ENV:Body>

      <ns:ContactQueryPage_Output xmlns:ns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact xmlns="urn:/crmondemand/xml/Contact/Data" recordcount="54" lastpage="false">

            <Contact>

               <ContactFirstName>Nick</ContactFirstName>

               <ContactLastName>Ray</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Joanna</ContactFirstName>

               <ContactLastName>Pressman</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Marianne</ContactFirstName>

               <ContactLastName>Pok</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Brian</ContactFirstName>

               <ContactLastName>Pittenger</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Marie</ContactFirstName>

               <ContactLastName>Perkins</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

         </ListOfContact>

      </ns:ContactQueryPage_Output>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Sample SOAP Request 3 - QueryPage with NamedSearchSpec

The following SOAP request queries for contact records in a specific contact list by specifying the contact list name in the <NamedSearchSpec> element.

Table 38 shows the records in the C Contacts list from the Oracle CRM On Demand UI. There are a total of 11 records in the list, therefore the recordcount value returned in the SOAP response equals 11.

Table 38. Example of Records in a Contact List
Row
Last Name
First Name
Contact Type
Owner Alias

0

Cuthbery

David

Customer

Donna Jones

1

Coxe

Robin

Customer

Donna Jones

2

Connolly

John

Customer

Jeff Smith

3

Connors

James

Prospect

Jeff Smith

4

Cone

Alexander

Customer

Ian McAllistair

5

Con6

NewCon6

Customer

Joanne Brown

6

Cohen

Adam

Customer

Ian McAllistair

7

Clatt

Mark

Customer

Donna Jones

8

Chu

Will

Customer

Jeff Smith

9

Chou

Ruth

Prospect

Donna Jones

10

Cheney

Jason

Prospect

Ian McAllistair

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <soap:Header>

      <wsse:Security>

         <wsse:UsernameToken>

            <wsse:Username>%%USERNAME%%</wsse:Username>

            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">%%PASSWORD%%</wsse:Password>

         </wsse:UsernameToken>

      </wsse:Security>

   </soap:Header>

   <soap:Body>

      <ContactQueryPage_Input xmlns="urn:crmondemand/ws/ecbs/contact/">

         <NamedSearchSpec>C Contacts</NamedSearchSpec>

         <ListOfContact pagesize="5" startrownum="0" recordcountneeded="true">

            <Contact>

               <ContactFirstName />

               <ContactLastName />

               <ContactType />

            </Contact>

         </ListOfContact>

      </ContactQueryPage_Input>

   </soap:Body>

</soap:Envelope>

Sample SOAP Response 3

The following SOAP response shows the list of contacts returned by sample SOAP request 3.

<?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <SOAP-ENV:Body>

      <ns:ContactQueryPage_Output xmlns:ns="urn:crmondemand/ws/ecbs/contact/">

         <ListOfContact xmlns="urn:/crmondemand/xml/Contact/Data" recordcount="11" lastpage="false">

            <Contact>

               <ContactFirstName>David</ContactFirstName>

               <ContactLastName>Cuthbery</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Robin</ContactFirstName>

               <ContactLastName>Coxe</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>John</ContactFirstName>

               <ContactLastName>Connolly</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>James</ContactFirstName>

               <ContactLastName>Conners</ContactLastName>

               <ContactType>Prospect</ContactType>

            </Contact>

            <Contact>

               <ContactFirstName>Alexander</ContactFirstName>

               <ContactLastName>Cone</ContactLastName>

               <ContactType>Customer</ContactType>

            </Contact>

         </ListOfContact>

      </ns:ContactQueryPage_Output>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Oracle Web Services On Demand Guide, Version 25.0 (Oracle CRM On Demand Release 37) Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.