SAP Knowledge Base Article - Public

3436023 - OData API query returning inactive employees even without using filter status in t,f - SuccessFactors OData API

Symptom

You noticed your API query is returning data for inactive employees even though you are not using the filter "status in t,f". 

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

    • OData API

Reproducing the Issue

  1. Run a query similar to this: https://api68sales.successfactors.com/odata/v2/User('cgrant')?$select=userId,firstName,lastName&$format=json
  2. Assuming employee "cgrant" is inactive, and since no status has been informed in the filters, no data should return on the response. 
  3. Response is returned normally, as below: 
"userId": "cgrant",
"firstName": "xxxxxx",
"lastName": "xxxxxxx",
"displayName": "cgrant"

Cause

API query using Key Predicate, hence it will query the database for all statuses.

Resolution

As explained in the OData Reference Guide, it works like this: 

Querying users by key predicate

When a key predicate is used, the query will return the matching entry regardless of user status. Below is an example of querying a user by key predicate:

https://<API-server>/odata/v2/User('cgrant')?$format=JSON
 
Please note: If you expand from a key predicate, you will only get expanded users in status t and T.

See Also

Querying Different Types of Users | SAP Help Portal

Query with Key Predicate | SAP Help Portal

Keywords

inactive employees, status, User, active employees, key predicate, status 't,f', external employees. , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HCM Suite all versions

Attachments

Pasted image.png