Symptom
How to identify the fields to be used in the 'orderBy' clause that will actually help in removing the duplicates and not degrade the API performance?
"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
SuccessFactors SFAPI & OData Entities
Resolution
In order to figure out the right fields that should be used in the 'orderBy' clause of any API query, you need to follow below steps-
1. Login to SFSF Instance.
2. Depending upon whether you are using SFAPI/OData API, navigate to Admin Center->SFAPI Data Dictionary/OData API Data Dictionary.
3. Now expand the entity for which you would want to use the 'orderBy' clause.
4. After expanding, observe the column 'Business Key' in the Entity definition and identify the fields that are marked as 'true' for this column (as shown in below screenshot).
5. Now whichever field is marked as 'true' should be used in the 'orderBy' clause and that can vary from one entity to other. For example- an entity may have 1 field defined as 'Business Key' whereas the other entity may have 2-3 fields defined as 'Business Key'.
6. The number of fields should not be a problem, the only consideration is to use the field marked as 'Business Key' in the orderBy clause.
NOTE: It is a standard recommendation that if you are using an OData entity to fetch huge number of records from your SFSF Instance you MUST use the 'orderBy' clause i.e. Sorting in your API queries to avoid any duplicate records in the response.
See Also
Keywords
Duplicate records, orderBy clause, business key fields, true, sorting, sorted, performance, OData, SFAPI, Data Dictionary, GET, query , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , How To
SAP Knowledge Base Article - Public