Represents a record shared between Salesforce organizations using Salesforce to Salesforce.
| Field | Details |
|---|---|
| ConnectionId | |
| EndDate | |
| LocalRecordId | |
| ParentRecordId | |
| PartnerRecordId | |
| RelatedRecords | |
| SendClosedTasks | |
| SendEmails | |
| SendOpenTasks | |
| StartDate | |
| Status |
If the organization does not have Salesforce to Salesforce enabled, the PartnerNetworkRecordConnection object is not available, and you can’t access it using the API.
The following example shows how to forward a record.
List<PartnerNetworkConnection)> connMap = new List<PartnerNetworkConnection>( [select Id, ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted'] ); for(PartnerNetworkConnection network : connMap) { PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection(); newrecord.ConnectionId = network.Id; newrecord.LocalRecordId = accountId; newrecord.RelatedRecords = 'Contact,Opportunity,Orders__c'; newrecord.SendClosedTasks = true; newrecord.SendOpenTasks = true; newrecord.SendEmails = true; insert newrecord; }
The following example shows how to stop sharing a record.
List<PartnerNetworkRecordConnection> recordConns = new List<PartnerNetworkRecordConnection>( [select Id, Status, ConnectionId, LocalRecordId from PartnerNetworkRecordConnection where LocalRecordId in :accounts] ); for(PartnerNetworkRecordConnection recordConn : recordConns) { if(recordConn.Status.equalsignorecase('Sent')){ //account is connected - outbound
delete nets; } }