SAP Knowledge Base Article - Public

2977366 - How to use the queryMore request to query all the results (pages) of a Compound Employee API request when the results exceed the max number of rows - SAP SuccessFactors HXM Suite

Symptom

  • You're performing a Compound Employee API request and getting a limited amount of records;
  • There are missing employees in the response payload.

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

Environment

  • SAP SuccessFactors HXM Suite
    • CompoundEmployee API


Resolution

In this KBA, we'll go through CompoundEmployee API's 'queryMore' request, as mentioned in Employee Central Compound Employee API - Query and QueryMore, and defined in SFAPI's WSDL file (you may refer to 2320264 - How to make an SFAPI call to test the functionality).

If the amount of employees selected by a query exceed the maximum configured page size (which is by default 200, and configurable from 1 to 800 using the maxRows parameter), you must use the queryMore request to fetch subsequent pages of records.

For instance, let's suppose the following CompoundEmployee request is requested:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <query xmlns="urn:sfobject.sfapi.successfactors.com">
            <queryString>
                SELECT person, personal_information, employment_information, job_information
          FROM CompoundEmployee
         </queryString>
        </query>
    </Body>
</Envelope>


Since I haven't defined a WHERE clause, this query will select all available employees in the SF instance. Naturally, the results will exceed the default response limit of 200 records, and that is verifiable by referring to the <hasMore> tag at the end of the response payload:



If the tag contains 'true', it means there are more records to be queried. In order to do so, you must copy the querySessionId and send it in the following request:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <queryMore xmlns="urn:sfobject.sfapi.successfactors.com">
            <querySessionId>4da3a633-3bf2-4512-b743-c8f76e0d50d1</querySessionId>
        </queryMore>
    </Body>
</Envelope>


This request will return the second page of results, and if it contains hasMore equals true again, another queryMore request should be sent. This should be repeated until a page is received with hasMore equals false, indicating the last set of results.

Keywords

missing, results, records, information, data, not, returned, returning, response, employees, users, more, subsequent, request, call, query, queryMore, remaining, more, page, set, next, fetch, retrieve, compoundemployee, ce , KBA , LOD-SF-INT-CE , Compound Employee API , LOD-SF-INT , Integrations , How To

Product

SAP SuccessFactors HCM suite all versions