2

I am ultimately trying to use data loader to migrate our chatter posts & comments that have files attached to them. They were originally added by uploading directly from computer to the comment. It looks like API version 36 and above, you are supposed to use the ContentVersion object to insert a new file, and then make references to them using the FeedAttachment object.

I've already migrated the users, collaborationGroups, collaborationGroupMembers, FeedItems and am stuck with getting the FeedComments that have files attached.

When I am inserting the ContentVersion objects, I would like to retain the original document properties and list the ownerID as the original user with their new cross referenced ID. However, I keep getting the following error: Documents in a user's private library must always be owned by that user.

If I leave the ownerID blank, it defaults to my id but successfully inserts into the new org.

This is an example of the data I'm inserting.

  • OWNERID: 005o0000002DMoTXXW
  • TITLE: title of file
  • PATHONCLIENT: C:\sfdc-migration\old org\attachments\myfile.pdf
  • VERSIONDATA: C:\sfdc-migration\old org\attachments\myfile.pdf
  • DESCRIPTION: description of file
  • ORIGIN: H

Questions:

  1. Am I able to set the owner ID to the original owner?
  2. If I insert with my own ID, am I able to easily update to the correct owner in a subsequent step?
  3. Is there an easy way to upload the file directly with the comments? In 35 and before, you can upload the files directly with the feedItem object, but it doesn't look like that is possible with feedComments?
  • I think you should go ahead without ownerId and then in subsequent steps use insertedByID as the userId for which you want the feedcomment . – Mohith Shrivastava Apr 7 '16 at 16:06
  • Also make sure your file was picked from public library and you are publishing the new content to a public library so you may insert wwith publishstatus as P – Mohith Shrivastava Apr 7 '16 at 16:08
  • Thanks @MohithShrivastava, I was able to insert as myself and then do a subsequent update. Not the ideal as it introduces more steps/risk of errors, but gets the job done. – jjurisch Apr 7 '16 at 17:24
  • 1
    You may want to put that as a solution to benefit the community – Mohith Shrivastava Apr 7 '16 at 17:26
3

I was able to work around this by inserting new ContentVersion with the following:

  • OWNERID: 005o0000002DMoTXXW (my id, or believe you can omit)
  • TITLE: title of file
  • PATHONCLIENT: C:\sfdc-migration\old org\attachments\myfile.pdf
  • VERSIONDATA: C:\sfdc-migration\old org\attachments\myfile.pdf
  • DESCRIPTION: description of file
  • ORIGIN: H

Then do a subsequent update on the ContentDocument object with:

  • ID: 069g0000000GOayAAG (resulting document id from insert)
  • OWNERID: 005o0000002DMoTAAW (correct owner ID)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.