You need to sign in to do that
Don't have an account?
Mayank Srivastava (Salesforce fan)
Is there a way to move a file automatically from Contents to Documents?
Is there a way to automate the transfer of a file from Contents to Documents on saleforce? I badly need to do this and would appreciate any sort of help on this.
hi friend,
You need to do some mappings in your code but you can do something like this:
Document doc = new Document (Name=GIVE_NAME_HERE, FolderId=GIVE_FOLDER_ID, Body= [Select c.VersionData, c.Title, c.Id, c.ContentDocumentId From ContentVersion c where c.ContentDocumentId =GIVE_ID_HERE].VersionData );
insert doc;
see if this helps.
All Answers
hi friend,
You need to do some mappings in your code but you can do something like this:
Document doc = new Document (Name=GIVE_NAME_HERE, FolderId=GIVE_FOLDER_ID, Body= [Select c.VersionData, c.Title, c.Id, c.ContentDocumentId From ContentVersion c where c.ContentDocumentId =GIVE_ID_HERE].VersionData );
insert doc;
see if this helps.
Soltion provided by Rahul will work. However, if document size is more than 5MB, it will fail. No Workaround for this.