Symptom
How to change Primary and Secondary Assignment in Concurrent Users via the Odata API
"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 HCM Suite
Resolution
1. Get the Primary User and Secondary Assignment User via get 'PerPerson' entity.
Get: {{URLTest}}PerPerson?$format=json&$filter=personIdExternal eq '103122'&$expand=secondaryAssignmentsNav/allSfProcesses&$select=secondaryAssignmentsNav/externalCode,secondaryAssignmentsNav/allSfProcesses/SecondaryAssignments_effectiveStartDate,secondaryAssignmentsNav/allSfProcesses/SecondaryAssignments_externalCode,secondaryAssignmentsNav/allSfProcesses/externalCode,secondaryAssignmentsNav/allSfProcesses/usersSysId
Response:
{
"d": {
"results": [
{
"__metadata": {
"type": "SFOData.PerPerson"
},
"secondaryAssignmentsNav": {
"results": [
{
"__metadata": {
"type": "SFOData.SecondaryAssignments"
},
"externalCode": "103122",
"allSfProcesses": {
"results": [
{
"__metadata": {
"type": "SFOData.SecondaryAssignmentsItem"
},
"SecondaryAssignments_effectiveStartDate": "/Date(1682985600000)/",
"SecondaryAssignments_externalCode": "103122",
"externalCode": "4c63783974b24af58e758f3cf6018e5b",
"usersSysId": "103124" ---- Secondary Assignment
}
]
}
}
]
}
}
]
}
}
2. Double confirm that 103122 is the Primary User and 103124 is the Secondary Assignment User via the User entity.
Get: {{URLTest}}User?$format=json&$select=userId,isPrimaryAssignment&$filter=userId in '103122','103124'
Response:
{
"d": {
"results": [
{
"__metadata": {
"type": "SFOData.User"
},
"userId": "103122",
"isPrimaryAssignment": true -> It means this userId is the primary assignment
},
{
"__metadata": {
"type": "SFOData.User"
},
"userId": "103124",
"isPrimaryAssignment": false -> It means this userId is secondary assignment
}
]
}
}
3. Exchange Primary User and Secondary Assignment User.
POST: {{URLTest}}upsert?$format=json
Payload
{
"__metadata": {
"uri": "SecondaryAssignments(effectiveStartDate=datetime'2016-05-02T00:00:00',externalCode='103122')"
},
"externalCode": "103122",
"allSfProcesses":
{
"__metadata": {
"uri": "SecondaryAssignmentsItem"
},
"SecondaryAssignments_effectiveStartDate": "/Date(1462147200000)/",
"SecondaryAssignments_externalCode": "103122",
"externalCode": "4c63783974b24af58e758f3cf6018e5b",
"usersSysId": "103122" ---- Secondary Assignment, changed from 103124 to 103122
}
}
Response:
{
"d": [
{
"key": "SecondaryAssignments/effectiveStartDate=2023-05-02T00:00:00.000-04:00,SecondaryAssignments/externalCode=103122",
"status": "OK",
"editStatus": "UPSERTED",
"message": null,
"index": 0,
"httpCode": 200,
"inlineResults": null
}
]
}
4. Same as #2 double confirm the Primary User is changed successfully.
Get: {{URLTest}}User?$format=json&$select=userId,isPrimaryAssignment&$filter=userId in '103122','103124'
Response:
{
"d": {
"results": [
{
"__metadata": {
"type": "SFOData.User"
},
"userId": "103124",
"isPrimaryAssignment": true -> It means this userId is the primary assignment user, changed from 103122
},
{
"__metadata": {
"type": "SFOData.User"
},
"userId": "103122",
"isPrimaryAssignment": false
}
]
}
}
Help portal of SecondaryAssignmentsItem
See Also
Keywords
Primary, Secondary Assignment, Concurrent Users, SF Odata API, exchange, change, concurrent , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , How To
Product
SAP SuccessFactors HXM Core 2305