cancel
Showing results for 
Search instead for 
Did you mean: 

Error: Required property hr is missing

khaled_kalo
Explorer
0 Kudos

Hi,

I am trying to create/upsert a new user in the SuccessFactors system using SAP Cloud Integration iFlow. I am using XSLT mapping with the SuccessFactors Adapter to post to SF. However, I am confused about an error with the hr property. The error message is as follows:

<message lang="en-US">ChangeSet index 1 - Please add required properties in payload. Required property hr is missing. 
                You can check which properties are required for an entity in Admin Center > OData API Data Dictionary or the entity metadata. with the index 0
</message>

XSLT-mapping:

I can do it with Postman, and it works. My payload in Postman is as follows:

{
    "__metadata": {
        "uri": "https://api2.successfactors.eu/odata/v2/User('81000001')",
        "type": "SFOData.User"
    },
    "userId": "81000001",
    "username": "TestMax",
    "country": "CHE",
    "status": "t",
    "timeZone": "Europe/Zurich",
    "hr": {
        "__metadata": {
            "uri": "User('81000002')",
            "type": "SFOData.User"
        }
    }
}

I think the structure of the XSLT mapping for hr is incorrect because hr is not like other properties; it is an object.

<hr> <User> <userId> <xsl:text>NO_HR</xsl:text> </userId> </User></hr>

Do you have any advice for me? Have you had any experience with errors related to the hr property?

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

daviddasilva
Active Contributor
0 Kudos

Hi,

Can you double check the API user has the Permissions for Human Resource as shown in this help page

Does this issue happen with all users you are trying to create?

Kind regards,

David

MatthiasS_Orbis
Newcomer
0 Kudos

Hi David,

thanks for your answers so far. I'm working with Khaled on this project on the SuccessFactors side.

The API user has all necessary permissions and it works perfectly fine with users if we send any existing UserID for the hr field.

However, our issue occurs if we try to import users via API who do not have any HR manager. We can neither leave the field empty nor can we use the "NO_HR" term, the result is the error Khaled showed above.

We currently have 2 assumptions: Either we are using the wrong term with "NO_HR" for this case or there is a bug where the cloud integration cannot handle this term (while Postman can process "NO_HR" without any problems).

I hope this helps to clarify the current situation.

Kind regards

Matthias

RussA
Participant
0 Kudos

In SuccesFactors No_HR usually mean no HR manager ID / Job Relationship within the User Data File. Meaning there is no assigned HR person for the employee.

Normally there are ~2 employees head of organization (top CEO) and/or head of HR that would not have that value sense top of org. Also will see integration users like API users and sometimes Consultant/Support ids like that as well.


Unsure, your situation. May need to filter out certain ids (like api accounts) and not load as regular employees and only create those within SF. For top of organization, I think you may need to first create head of HR/Head of Org in SF before and load rest. All other employees though, should have an HR assigned by default SF.

Hope helps. Best of luck.

daviddasilva
Active Contributor
0 Kudos

Hi Khaled,

Could you try placing an XML to JSON converter after the mapping to view the payload as a JSON and you can view where it is different?

Assuming the payload is correct, is there a possibility that the error is asking for hr to have a valid value? Maybe "NO_HR" is not a valid value?

Kind regards,

David

khaled_kalo
Explorer
0 Kudos

Hi David.

If I upsert for the first time with Postman, it also works with xslt-mapping. The payload is correct, but I'm not sure if the HR structure is correct.

daviddasilva
Active Contributor

Hi khaled_kalo

Have you tried making a GET request to see what the structure is like? Also you might find more details on the structure of this in api.sap.com. Which API are you using? I think it is this one: https://api.sap.com/api/PLTUserManagement/overview

In fact, when I do convert this JSON to XML I get the following payload:

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

<root>

<userId>81000001</userId>

<username>TestMax</username>

<country>CHE</country>

<status>t</status>

<timeZone>Europe/Zurich</timeZone>

<hr/>

</root>"

Perhaps you can test with something like this to see if this structure works?

Kind regards,

David

khaled_kalo
Explorer
0 Kudos

Hi David.

I am using the API at https://api2preview.sapsf.eu. I noticed in your output that the 'hr' field is empty. Have you tried assigning a value to 'hr,' such as 'NO_HR' or a specific 'userId'? In my case, when I leave 'hr' empty, I encounter an error.

Kind regards,

Khaled