Symptom
When I am performing an OData call, the system does not order the fields accordingly to the order that I use in my query.
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 Recruiting Management
- Job Requisition;
SAP SuccessFactors
- OData API (all entities).
Reproducing the Issue
- Using as an example the Job Requisition entity, perform the following call: [data_center_uri]/odata/v2/JobRequisition?$select=jobReqId,country,division,department,location
- Notice that the order that I have set is:
- jobReqId
- country
- division
- department
- location
- Now, once I run the query, the system will return the following result:
Notice that the order comes as: jobReqId, division, country, location, department, Which is not alphabetical order, or the $metadata order, neither the one we have set on our $select.
Resolution
This is how the system behaves, for you to understand in which order the fields will come when you perform a query, you can perform a query without a $select parameter, to see which will be the order.
- Still using the Job Requisition as our entity to query, run the following query: [data_center_uri]/odata/v2/JobRequisition?$top=1
- The result of this query will be a huge amount of fields, which are all the fields in the entity that you queried on, and the respective order as they will come if you perform any query on it;
Keywords
OData, order, query, top, select, fields, entity, response, metadata , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , Integrations , LOD-SF-RCM-API , Webservices & APIs , How To
Product
SAP SuccessFactors HXM Core all versions ; SAP SuccessFactors HXM Suite all versions ; SAP SuccessFactors Recruiting all versions