cancel
Showing results for 
Search instead for 
Did you mean: 

Extract email attachments and send data to SuccessFactors

khaledkalo
Explorer
0 Kudos

Hi All,

I need to extract an Excel file from an email as an attachment and convert it to JSON, then dynamically set the data and send it to SuccessFactors. I can do it manually via Message Body in Content Modifier, but I need to dynamically set data directly from Excel step like this. My manual example is here:

How to insert data dynamically? Can I write Groovy script in Content Modifier Message Body? (I'm new to SAP BTP field) i made like example in below, but it doesn't seem to be working.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi khaledkalo,

On a Cloud Integration Flow you cannot run a script on Content Modifier.

https://blogs.sap.com/2021/12/03/sap-integration-suite-deep-dive-into-content-modifier/

The message flow would be something like the following:

inbox as sender --> extract attachment --> check attachment type is excel --> use a groovy script to process the excel file --> generate results in JSON or XML -> map the fields with Content Modifier --> Send the Message to a receiver system.

There are some useful scripts here that you could adapt to your needs:
https://api.sap.com/integrationflow/com.sap.aibus.dox.fetch.email

1. You can convert the attachment data from CSV to XML and then use XPATH to map the data. Or you could add the expected result as an OpenAPI yaml file and import it to make mapping as drag and drop.

or

2. You could use some helper classes that allows you to extract the data directly from XLS format using:

https://blogs.sap.com/2018/09/04/formatconversionbean-arrives-in-cpi/

Best regards,
Ivan

Answers (0)