Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to attach pdf file into SalesForce.
I use the tSalesForceOutput with module Name : ContentVersion
I put the fields : TITLE / DESCRIPTION / PathOnClient / VersionData (as with DataLoader SF).
My job is running successfully but my pdf file in SalesForce is empty.
My job in attachment.
I'm in Talend 7.0.1
Any idea?
Jérémy
@jblot,check the below link for the example.
https://corycowgill.blogspot.com/2013/06/inserting-pdf-attachments-into.html
At least, the document must be Base64 converted to populate the VersionData field.
@manodwhb, ContentVersion is not the same as Attachment
Hi,
Thank you for your response.
I try to convert my field but I have the same problem : my pdf is empty in SalesForce.
This is my tMap :
I attach my job
Hi all,
Finally, I resolve my problem with this code :
File file = new File((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"));
try {
FileInputStream documentInFile = new FileInputStream(file);
byte[] documentData = new byte[(int)file.length()];
documentInFile.read(documentData);
output_row.Body = new String(Base64.encodeBase64(documentData));
} catch (FileNotFoundException e) {
output_row.conversionCode = "FILE_NOT_FOUND";
output_row.conversionMessage = "File not found "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH");
System.out.println("*** File not found "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")+"\n"+e);
} catch (IOException ioe) {
output_row.conversionCode = "CONVERSION_ERROR";
output_row.conversionMessage = "Error converting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH");
System.out.println("*** Error converting file "+(String)globalMap.get("tFileList_1_CURRENT_FILEPATH")+"\n"+ioe);
}
I put this result in field VersionData on the ContentVersion module name
Jérémy