Symptom
How to upload the attachment through OData API call, obtain attachment id and then link it via termination details import
*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
- SAP SuccessFactors Employee Central
Reproducing the Issue
- Collect Employee User Id
- Attachment filename
- Collect attachment file content in Base64 String
- Collect AttachmentId from PostMan response data
- Update the Termination template with Attachment Id
- Import Termination Template
- Verify the attachment details displays in Employee details page
Resolution
Collect Attachment file content in Base64 String
1. Open powershell in windows
2. Modify the below commend with file path
[convert]::ToBase64String((Get-Content C:\Users\testuser01@sap.com\Pictures\DOCTOR_CERTIFICATE.PNG -Encoding byte))
The content
Ex:
PS C:\> [convert]::ToBase64String((Get-Content C:\Users\testuser01@sap.com\Pictures\DOCTOR_CERTIFICATE.PNG -Encoding byte))
iVBORw0KGgoAAAANSUhEUgAABncAAAM2CAYAA
CONTENT_REMOVED
AAAElFTkSuQmCC
PS C:\>
3. Copy the content and update in JSON payload filed “fileContent”
Postman – upload attachment
1. Now open Postman and upload an attachment to the OData Attachment entity for user with userId = 310xxxx (For Ex: 310) using an OData POST call.
2. URL of the OData API of the SF instance:
(Here you can use the API URL corresponding to your data center)
3. Credentials used in Postman to upload the attachment (with an OData POST call):
Username: USER_NAME@COMPANY_ID
Password: PASSWORD
3. Concrete URL to upload the attachment (with an OData POST call):
4. This is the JSON payload of this OData call:
5. Verify in Postman that the call is successful:
6. Check the response in Postman
In this example it is:
7. Please make sure to mark/remember the attachmentId returned by SuccessFactors (6242 in this example).
SF – Check upload of attachment
1. Verify in SuccessFactors that the upload of the attachment is successful, using the Manage Documents functionality inside SF:
2. Modify the Terminate Temple:
3. Update the attachment_id value with : 6242 (which we collected from Postman Response) and upload the data. And ensure the attachment details appears in Job Information section in the employee details page.
See Also
Keywords
attachment, OData API call, obtain attachment id, attachment id, termination details, import, Postman , KBA , LOD-SF-INT-ODATA , OData API Framework , LOD-SF-EC-EDP , Import Employee Data (EC Core only) , How To