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
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

  • SAP Managed Tags:
6 Comments
ankumarj
Member
0 Kudos
Hello Carson,

I am trying the same thing however I am getting below error (I have super admin right).

[COE0018]No permission to access the attached file ABCDEF.jpg. Attachment in field cust_attachment does not belong to the user XXXXXX.

 

I am not sure what causing this problem as I tried with all different parameters.

Any suggestions.

Best Regards,

AK
jaideepshetty
Participant
0 Kudos
Hi Anuj Kumar,

 

Did you find the cause or solution for your issue?

 

Thank You,

JD
0 Kudos
Hi Anuj Kumar.

 

I have the same issue.

Did you find the solution??
navepras
Explorer
0 Kudos
Hi All

I have same issue .. As per the document all are configured correctly but still i get below error

[COE0018]No permission to access the attached file Testpdf.pdf. Attachment in field cust_interimReport does not belong to the user apiuser.



Can anyone suggest how to solve this issue


Regards

Naveen V


former_member22818
Participant
Hi Naveen,

 

Even I was facing the same issue. I am able to solve it now.

In the above blog, if you carefully observe, there are 2 different userID used.

In step 7, you need to pass UserID=API User. In your case it should be apiuser.

In step 8, you can use the actual employee's userID which you are testing.

 

Regards,

Vishwas N
jaimejulio
Discoverer
0 Kudos
Thanks, It worked!!
Labels in this area