Box for Salesforce createFileFromAttachment with ContentDocument
We created a trigger in Salesforce on the Case object to automatically add any Attachments to Box using the createFileFromAttachment File Operation
Salesforce has changed their attachment process to ContentDocument
Is there a similar boxToolkit method for adding ContentDocuments?
-
Almost a year later - is there any way to move a file from Salesforce's Files to Box similar to the createfilefromattachment?
We switched to Lightning and all files are now being added as Files instead of Attachments and SF is not part of our content strategy.
-
There is a pretty ugly workaround you can use in Apex.
ContentVersion cv = [SELECT VersionData, Title, FileExtension FROM ContentVersion WHERE ContentDocumentID = YOUR-CONTENT-DOC];
Attachment myAttachment = new Attachment(Name = cv.Title + '.' + cv.fileExtension, Body = cv.VersionData, ParentID = YOUR-PARENT-ID);
Then you can call the boxtoolkit createFromAttachment, pass in "myAttachment" . No need to actually insert the attachment.
Not ideal, but if your users are uploading Files instead of attachments, it's a way around.
Post is closed for comments.
Comments
4 comments