PartnerNetworkRecordConnection

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

Supported Calls

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

Fields

Field Field Type Field Properties Description
ConnectionId reference Create

Filter

Nillable

Required. ID of the connection a record is shared with.
EndDate dateTime

Filter

Nillable

Date that sharing of the record was stopped.
LocalRecordID reference Create

Filter

Required. ID of the shared record.
ParentRecordID reference Create

Filter

Nillable

ID of the parent record of the shared record.
PartnerRecordID reference Filter

Nillable

ID of the shared record in the connection's organization.
RelatedRecords string Create

Filter

Nillable

A comma-separated list of API names for child records to be shared with a parent record.
SendClosedTasks boolean Create

Defaulted on create

Filter

Forwards closed tasks related to the shared record.
SendEmails boolean Create

Defaulted on create

Filter

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

Defaulted on create

Filter

Forwards open tasks related to the shared record.
StartDate dateTime

Filter

Nillable

Date that the shared record was accepted.
Status picklist

Filter

Nillable

Restricted picklist
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.
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 cannot 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-2009 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.