SAP Knowledge Base Article - Public

2657419 - Matrix manager gets concatenated instead of being overwritten while using Upsert Call on User ODATA API Entity

Symptom

Matrix manager gets concatenated instead of being overwritten while using Upsert API Call for User ODATA Entity

This can be checked in the UDF File downloaded from Admin Center > Employee Export > Select 'Valid users only' under Specify Export Options > Export User File

208_Paint.PNG

Environment

SuccessFactors

Reproducing the Issue

1. Upsert the Matrix Manager for a user who is already having a Matrix Manager in the system

   > For example the sample employee with userId 205 already has a matrix manager with userId 207 in the system

   > This can be checked in the UDF File downloaded from Admin Center > Employee Export > Select Valid Users only under Specify Export Options > Export User File

   > Check the column MATRIX_MANAGER for the sample userId 205

207_paint.PNG

2. Now you want to change the matrix manager for the sample userId 205 from 207 to 208.

3. You make the below API Call:

 API Request Header: POST https://apisalesdemo4.successfactors.com:443/odata/v2/upsert

 API Request Payload:

{
 "__metadata":

 {
  "uri": "User(userId='205')"
 },
 "matrixManager": {
  "__metadata": {
   "uri": "User(userId='208')"
  }
 }
}

4. Check the matrix manager for the sample employee 205.

   > This can be checked in the UDF File downloaded from Admin Center > Employee Export > Select Valid Users only under Specify Export Options > Export User File

   > Check the column MATRIX_MANAGER for the sample userId 205

   > MATRIX_MANAGER would have been concatenated to 207|208

208_Paint.PNG

Cause

  • This is an expected behavior.
  • When you already have a matrix manager for a user and you send a new matrix manager in the upsert request the ODATA API upsert call will add the new manager along with the old manager. 
  • Since the relation between an employee and matrix manager is one to many (1:N), everytime you try to upsert the employee with a new matrix manager, ODATA API will append the matrix manager instead of overwriting it. 

Resolution

If you want to overwrite an existing matrix manager for an employee, below 2 workarounds are available:

1. Check whether matrixManager has existed,

  • if true use PUT $links (In the below example for the userId 205 > matrix Manager with userId 207 already exists in the system and you want to replace it with userId 208 as a Matrix Manager)

PUT https://apisalesdemo4.successfactors.com/odata/v2/User('205')/$links/matrixManager('207')

Content-Type: application/xml

<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
  https://apisalesdemo4.successfactors.com/odata/v2/User('208')
</uri>

  • if false, use POST $links (In the below example userId 205 is not having a matrix Manager in the system and you want userId 208 as the Matrix Manager)

POST https://apisalesdemo4.successfactors.com/odata/v2/User('205')/$links/matrixManager

Content-Type: application/xml

<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
  https://apisalesdemo4.successfactors.com/odata/v2/User('208')
</uri>

2. DELETE $links first, and then POST $links (In the below example we are first deleting the Matrix Manager of userId 205 and then adding the Matrix Manager with userId 208 to the user with userId 205)

DELETE  https://apisalesdemo4.successfactors.com/odata/v2/User('205')/$links/matrixManager

POST https://apisalesdemo4.successfactors.com/odata/v2/User('205')/$links/matrixManager

Content-Type: application/xml

<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">
  https://apisalesdemo4.successfactors.com/odata/v2/User('208')
</uri>

 

Keywords

Matrix_Manager, Matrix Manager, User, Upsert Call, ODATA API Entity, Concatenate, Overwritten, PUT, POST, DELETE , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-INT , SF Integrations - EC Payroll, Boomi/ HCI, API , Problem

Product

SAP SuccessFactors HCM Core 1805