Skip to main content

Questions about converting Attachments to Files in the context of multiple Communities.

 

Context

  • I have multiple customer/partner communities (e.g. 5)
  • I have a community user with access to some of these communities (e.g. 2 of 5)
  • An Account is accessible to all 5 communities plus the internal community
  • The community user uploads an Attachment to that Account
  • Now I want to convert the Attachment into a File...

 

Questions

  1. When I convert the Attachment into a File (ContentVersion object) I will need to specify the ContentVersion.NetworkId to make the File available to a community. If the Account and User who uploaded the Attachment are accessible to multiple communities, what qualifier in the data can I use to know which NetworkId to set?
  2. And if a ContentVersion only has one NetworkId field does that mean to convert one Attachment and be available to multiple communities I must actually convert it into multiple files?
  3. Can I have one ContentVersion record but share to multiple communities via ContentDocumentLink?

 

Thanks!

5 commentaires
  1. 17 mars 2017, 03:26
    Hi @Neil Hayek

    , I've done more testing and things look good as you say.

    It helps that this time I ensured I actually assigned the permission set to my user to grant "create audit fields". I had created the permission set but failed to actually assign it to myself. That was a crucial missed step, doh!

    I've confirmed that in both Apex and using REST API (

    https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm

    ) I can indeed set the audit fields: CreatedById, CreatedDate, LastModifiedById, LastModifiedDate.

    Thanks for the help!

0/9000