Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
CarsonWongCBL
Active Participant
5,519
  • SAP Managed Tags:
This blog is to demonstrate the steps to upsert an attachment in custom MDF through OData API.

 

Below are the steps for proof-of-concept:

1. Create custom MDF (Admin Center > Configuration Object Definitions)



  • API Visibility = Editable

  • Subject User Field = externalCode




  • set externalCode's data type as 'User' so that it can be used in Employee Profile

  • create field cust_attachment with data type 'Attachment'




  • Always a practice to set the RBP control for custom MDF


 

2. Create Configuration UI (Admin Center > Manage Configuration UI)



  • Set externalCode as not visible (which will auto-fill user ID)


 

3. Configure People Profile (Admin Center > Configure People Profile)



 

4. Update RBP for ESS/MSS/Admin Users (Admin Center > Manage Permission Roles)

  • User Permissions > Employee Views (so as to show custom MDF in People Profile)

  • User Permissions > Miscellaneous Permissions (so as to maintain the custom MDF records)


 

5. Update RBP for OData API Access User (Admin Center > Manage Permission Roles)

  • Administrator Permissions > Manage Integration Tools > OData API Attachment Import

  • Administrator Permissions > Manage Integration Tools > OData API Attachment Export


 

6. Refresh OData Metadata (Admin Center > OData API Metadata Refresh And Export)



 

7. OData API - Step 1: Import file to Attachment entity (via Postman)



  • POST URL: https://apisalesdemo2.successfactors.eu:443/odata/v2/Attachment

  • Body:

    • userId: the user ID of OData API User (Mandatory)

    • fileName: file name (Mandatory)

    • module: GENERAL_OBJECT for custom MDF (Mandatory)

    • fileContent: the attachment file in base64 encoded format (Mandatory)



  • Send the OData request




  • Attachment ID (ie. 7447) is returned (keep this ID for later use)


 

8. OData API - Step 2: Insert custom MDF record to employee with attachment ID (via Postman)





  • Response Message


 

9. Check in People Profile



 

Using Postman to send OData queries is only for proof-of-concept purpose and in real project, you may use other programming language to develop a end-to-end process scenario.

 

Reference:

  1. SAP KBA 2599554 - Odata attachment upsert to custom MDF Object not reflecting attachments in UI

  2. SAP SuccessFactors HCM Suite OData API: Reference Guide

6 Comments
Labels in this area