SAP Knowledge Base Article - Public

3096633 - How to create Position records with auto generated codes - OData API

Symptom

You need to create Position records with auto generated codes through OData API. This means that you don't want to pass any code values in the Upsert payload, making SF create the codes by itself.

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

Resolution

You need to provide an Upsert payload as below:

{
    "effectiveStartDate": "/Date(1630454400000)/",
    "division": "DEV",
    "effectiveStatus": "A",
    "positionTitle": "0",
    "__metadata": {
        "type": "SFOData.Position",
        "uri": "Position"
    }
}

You should not pass any values to "code" field.

Also in the "uri" field inside the __metadata brackets, you just need to provide "Position" value.

This will return the following response with the auto generated code:

<m:properties>
        <d:key>Position/code=3001071,Position/effectiveStartDate=2021-09-01T00:00:00.000-04:00</d:key>
        <d:status>OK</d:status>
        <d:editStatus>UPSERTED</d:editStatus>
        <d:message m:null="true"></d:message>
        <d:index m:type="Edm.Int32">0</d:index>
        <d:httpCode m:type="Edm.Int32">200</d:httpCode>
        <d:inlineResults m:type="Bag(SFOData.UpsertResult)"></d:inlineResults>
</m:properties>

See Also

Position - SAP Help Portal

Keywords

id, system, created, automatic, identifier, payload, json, xml, sf, number, digit , KBA , LOD-SF-INT-MDF , Metadata Framework API (MDF) , LOD-SF-INT-ODATA , OData API Framework , How To

Product

SAP SuccessFactors HCM Core all versions