Represents a record shared between Salesforce.com organizations using Salesforce to Salesforce.
| Field | Field Type | Field Properties | Description |
|---|---|---|---|
| ConnectionId | reference | Create | Required. ID of the connection a record is shared with. |
| EndDate | dateTime | Date that sharing of the record was stopped. | |
| LocalRecordID | reference | Create | Required. ID of the shared record. |
| ParentRecordID | reference | Create | ID of the parent record of the shared record. |
| PartnerRecordID | reference | Filter | ID of the shared record in the connection's organization. |
| RelatedRecords | string | Create | A comma-separated list of API names for child records to be shared with a parent record. |
| SendClosedTasks | boolean | Create | Forwards closed tasks related to the shared record. |
| SendEmails | boolean | Create | Sends an email notifying the connection's representative that you have forwarded the record to them. Only new recipients of a record will receive a notification email. |
| SendOpenTasks | boolean | Create | Forwards open tasks related to the shared record. |
| StartDate | dateTime | Date that the shared record was accepted. | |
| Status | picklist | Restricted picklist | The status of the shared record. One of the following values:
|
If the organization does not have Salesforce to Salesforce enabled, the PartnerNetworkRecordConnection object is not available, and you cannot 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;
}
}