cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Upsert ToDoV2 Entity to Successfactors from SAP CPI

0 Kudos

Hi,

I am trying to upsert ToDoV2 entity into Successfactors from SAP CPI.I am using a SuccessFactors Adapter to upsert.

But the upsert operation fails with the below error for property userID.

My input payload is :

<?xml version="1.0" encoding="UTF-8"?>

<TodoEntryV2>

<TodoEntryV2>

<categoryId>41</categoryId>

<linkUrl>https://www.test.com/</linkUrl>

<status>2</status>

<todoEntryName>Test123_Odata_2</todoEntryName>

<userNav>

<User>

<empId>123</empId>

</User>

</userNav>

</TodoEntryV2>

</TodoEntryV2>

Response Payload :

<?xml version='1.0' encoding='utf-8'?>

<UpsertResponses>

<TodoEntryV2UpsertResponse>

<key null="true"/> <status>ERROR</status>

<editStatus null="true"/>

<message>Property userNav does not support inline insert operation</message>

<index type="Edm.Int32">0</index>

<httpCode type="Edm.Int32">400</httpCode>

<inlineResults type="Bag(SFOData.UpsertResult)"/>

</TodoEntryV2UpsertResponse>

</UpsertResponses>

Can you help me to resolve this error?

Kindly let me know how to handle this in CPI?

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Solution is to add a link property in the XML and then add the userNav and upsert it using HTTP Adapter

<?xmlversion="1.0" encoding="UTF-8"?><TodoEntryV2><TodoEntryV2><link><userNav><userId>123</userId></userNav></link><categoryId>41</categoryId><status>2</status><todoEntryName>Test123_Odata_2</todoEntryName></TodoEntryV2></TodoEntryV2>
IvoVermeer
Explorer
0 Kudos

Hi Shruthi,

You are filling the userId on the User entity, using the userNav navigation property. You should try to fill the userId field on the TodoEntryV2 itself. Like so:

(the position within TodoEntryV2 does not matter, as long as it's a direct child of it)

<?xml version="1.0" encoding="UTF-8"?>
<TodoEntryV2>
    <TodoEntryV2>
        <!-- userId goes here -->
        <userId>123</userId>
        <categoryId>41</categoryId>
        <status>2</status>
        <todoEntryName>Test123_Odata_2</todoEntryName>
    </TodoEntryV2>
</TodoEntryV2>

If you only have the user's empId, you should first retrieve the userId by GETing that entity and extracting tje userId from it.

0 Kudos

Hi Ivo,

I tried upserting userID directly.But userid feild is not upsertable in the TodoEntryV2 entity in Successfactors.

But when the above is tried through postman as a JSON it works.

But am unable to achieve it from CPI.

IvoVermeer
Explorer
0 Kudos

Hi Shruthi,

I advise to always use a mapping step and in that uses the XSD that you get from the SuccessFactors ODatav2 connector. Make sure you include all key fields when setting up the connector, as the connector will put then into the url part of the call and not in the body. SuccessFactors. Then it should always work. Usinc just a content modifier to build the body for an SF Odata request can lead to unexpected behaviour