PartnerNetworkRecordConnection

Represents a record shared between Salesforce organizations using Salesforce to Salesforce.

Supported Calls

create(), delete(), query(), retrieve()

Fields

Field Details
ConnectionId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort
Description
Required. ID of the connection a record is shared with.
EndDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Date that sharing of the record was stopped.
LocalRecordId
Type
reference
Properties
Create, Filter, Group, Sort
Description
Required. ID of the shared record.
ParentRecordId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort
Description
ID of the parent record of the shared record.
PartnerRecordId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
ID of the shared record in the connection's organization.
RelatedRecords
Type
string
Properties
Create, Filter, Nillable, Sort
Description
A comma-separated list of API names for child records to be shared with a parent record.
SendClosedTasks
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort
Description
Forwards closed tasks related to the shared record.
SendEmails
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort
Description
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
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort
Description
Forwards open tasks related to the shared record.
StartDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
Date that the shared record was accepted.
Status
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
The status of the shared record. One of the following values:
  • Active (received)
  • Active (sent)
  • Connected
  • Inactive
  • Inactive (converted)
  • Inactive (deleted)
  • Pending (sent)

Usage

When you create a PartnerNetworkRecordConnection, you forward a record to a connection.
Note
Attempting to forward a record from an object to which the connection is not subscribed results in an Invalid Partner Network Status error.

Don’t forward a record to the connection that originally shared it. Doing so causes errors when Apex triggers run.

When you delete a PartnerNetworkRecordConnection, you stop sharing a record with a connection.

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.

Sample Code—Apex

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; } }
© Copyright 2000–2014 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.