Sunday 14 July 2019

S2S File Sharing

For Salesforce 2 Salesforce Introduction & FAQ Refer

1.PDF File sharing is possible in S2S ?
Yes,Using the ‘Attachment’ related list 

Publish & Subscribe the Attachment object from Org1 to Org2.
Note : To all the supported objects of S2S only.Refer

2.More than one pdf file can be shared ?
Yes,Whatever the part of Attachment object all files will be transferred.

3.Is there any limit on file size? What should be the size of file ?
Yes,It should be 20 MB  / Less [Each File size]

4.What happens if the file size is more than 20MB ?
There will not be any error / validation/no log in the connection history,The parent record will gets published and this attachment child record will be in queue forever.
Ex: Account & Attachment published - Account will get received but not the attachment because of its huge size.

5.In case of multiple files,Can we punch only the specific file to share?
Yes,
Solution 1 :  Using “Share with connections” checkbox on the attachment file detail.



Solution 2 :  While programmatically forwarding the record then can query the record based on the  business rule and send only that record. 

PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection( ConnectionId = network.Id,
LocalRecordId = a.id,
ParentRecordId =a.id.ParentId, 

SendClosedTasks = false, SendOpenTasks = false,SendEmails = false);

6.Share the Contract PDF from one org to another?
Contract is not supported in S2S integration,Refer below link to know the unsupported standard objects.Refer
Workaround will be attach the contract pdf to any of the supported objects and tune the business logic to achive this requirement.

7.Programatically can share the attachment files ?
Yes

8.In S2S,How to share the files programatically ?
Solution 1 : While sharing the parent record programmatically add the below attribute to share the attachment child records.



------------------------------------------------------------------------------------------------------------------------
// Define Network id
String connectionName = 'SF_Bytes'

List<PartnerNetworkConnection> partnerNetConList =  [Select id from PartnerNetworkConnection where connectionStatus = 'Accepted' and connectionName = :connectionName];

Id networkId = partnerNetConList.get(0).Id;

// Send Parent & Child (Attachment File) programatically
PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection( 
            ConnectionId = networkId, 
            LocalRecordId = '0010S00000OnyrK', SendClosedTasks = false, 
            SendOpenTasks = false, SendEmails = true,RelatedRecords='Attachment');

insert newConnection;
------------------------------------------------------------------------------------------------------------------------


Solution 2 : Write trigger logic on the Attachment and insert the record into the PartnerNetworkRecordConnection along with the Parent Record Id & Attachment Record Id.

9.Continuous sync of attachment files possible ? 
No,It will not publish the new attachment once the parent record is published.
will through an exception.


Solution : Re-publish the parent record by selecting the attachment file with “Share with connections” check box.
Ex1.: Account → Added one Attachment & Published the Account & Attachment ,Expected O/P both will get received in the target  org.
Later added another attachment to that Account ,That will not get published.
Ex2: Publish the parent record & Later add the attachment through programmatically.That will not get published.
Refer the above solution.

10.How to test the status of the published record Parent & Child? 


1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete