SAP Knowledge Base Article - Public

2808267 - Query with navigation to User entity has the "userNav" field returning as null - OData API

Symptom

You perform a query which has a navigation to the User entity and the "userNav" field returns only a "null" value. Due to this, further results that would be returned about the User entity are not returned.

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

Environment

  • SuccessFactors HXM Suite
    • OData API

Reproducing the Issue

  1. Perform a query which has a navigation to the User entity through the "userNav" field, for example a query on EmpJob:

    https://apisalesdemo4.successfactors.com/odata/v2/EmpJob?$format=json&$expand=userNav&$select=userId,location,userNav/lastName,userNav/firstName,userNav/username&$filter=userNav/userId eq '666'

  2. You get a similar result:

    {
        "d": {
            "results": [
                {
                    "__metadata": {
                    "uri": "https://apisalesdemo4.successfactors.com:443/odata/v2/EmpJob(seqNumber=1L,startDate=datetime'2019-04-06T00:00:00',userId='666')",
                    "type": "SFOData.EmpJob"
                },
                "userId": "666",
                "location": "7000-0001",
                "userNav": null
                }
            ]
        }
    }

Cause

There are two possible causes, which are related to permissions assigned to the API user performing the query:

  • If the API user HAS the "Employee Export" permission enabled: the API user is trying to query a user which is not in the permission role's target population (missing row-level permission). Skip to the "NOTE" at the end of the Resolution segment of this KBA if this is your case.
  • If the API user does NOT have the "Employee Export" permission enabled: the API user is trying to query an user which is not in the permission role's target population AND/OR some field query permissions of the User entity are missing.

Resolution

Consult the following page for reference on which permissions related to the User entity are needed: SAP SuccessFactors HXM Suite OData API: Reference Guide

Besides granting the proper permissions to the API user, be sure that the users which should be queried are included in the target population of the permission role related to the API user:

userNav_null_1.jpg

NOTE: As mentioned in the SAP SuccessFactors HXM Suite OData API: Reference Guide: if you have the "Employee Export" permission enabled for the API user, it will override any field-level permission and you'll have access to all the User entity's fields of the users which are in the permission role's target population, so there is no need to add any permissions to the permission role. What you'll have to do is expand the target population by including the group of users which you'll need to query.

Keywords

successfactors, success, factors, odata, api, call, query, null, empty, blank, value, not, return, permission, access, role, unable, get, data, edit, granting, shows, returns, showing, usernav is null, not , KBA , LOD-SF-INT , Integrations , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HXM Suite all versions