We have S2S connection establishment between two salesforce instances and its working fine without any issues.

In this S2S connection, we have a process to share the related records whenever we share the parent record from one salesforce to another salesforce instance. below is the code that I am using for sharing process.

    //Preparing records to send using PartnerNetworkConnection
    PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();
    newrecord.ConnectionId = conn.Id;
    newrecord.LocalRecordId = recordId;  
    newrecord.SendClosedTasks = false;
    newrecord.SendOpenTasks = false;
    newrecord.SendEmails = false;
    newrecord.RelatedRecords = 'Attachment';
    insert newrecord;

Now we are changing the attachments to files and I do not see any option to send the Files as RelatedRecords through this process. I tried to change the newrecord.RelatedRecords = 'Attachment'; as

newrecord.RelatedRecords = 'ContentDocumentLink'; OR newrecord.RelatedRecords = 'ContentDocument';

With this change, I am getting an error as,

ContentDocument not related to SObject(basically related object)

I tried to find a solution through salesforce docs but I don't see any relevant information. https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_partnernetworkrecordconnection.htm

Does anyone know how to send files relatedlist in S2S connection?



You must log in to answer this question.

Browse other questions tagged .