This blog describes how to upsert the attachments into Successfactors using SAP Cloud Platform Integration. I am using Job Application OData API to achieve this.
For any Attachment to upsert into Successfactors OData API, we should have to do this through Attachment OData API. Attachment is a generic API to upsert any attachment in Successfactors.
In this blog i am going to explain how to upsert the PDF file into JobApplication API. In my JobApplication API, I have a custom field whose data type is Attachment and having the navigation to Attachment API from that field. If you select the Sub Level-1, you can see the attachment fields. Any how, i have not used the Succssfacors adapter to upsert. I am just showing this screenshot for API navigation and field structure.
Once you select the JobApplication API, the business key field will be automatically ticked the check box and it appears in the upsertable fields list. But coming to the Attachment API, Attachment ID is the business key but we should not upsert any data into this field. In Attachment API, we have to select the fileContent, fileName, module fields. These 3 are the required fields in this API.The DataType for fileContent field is Base64. For module field you can hardcode to RECRUITING.
Integration flow design:
In the above screenshot, I get the PDF File content from HTTP Adapter and after that i am using the Encoder shape to do the Base 64 format of the PDF Content. After that i am creating one header as Content-Type as "application/json". In Property, i have created one property as PDF and given the value to that property as the Base 64 Encoded data. After that i have created the body, which will accepts by the JobApplication API.
Content Modifier Screenshot:
Header:
Property:
Body:
Sample Json Data to Upsert:
{
"__metadata":{
"uri": "JobApplication(applicationId='1234')"
},
"applicationId": "1234",
"cust_ResultField":{
"fileContent":"SGVsbG8gV29ybGQh",
"module":"RECRUITING",
"fileName":"Result.pdf"
}
}
After that i am logging the payload data in the groovy script. After that, i am using the HTTP adapter to upsert the data into successfactors using POST operation and followed by the response catching using groovy script.
Best Regards,
Imran