function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iceberg4uiceberg4u 

Salesforce to Salesforce problem

I tried to use the Salesforce to Salesforce functionality in my Apex code.for this I used two sandboxed organizations,each activated their Salesforce to Salesforce and a connection has alos been implemented.I then published a record->"CurrencyMaster" and some fields similarly on the other environment I subscribed to the same record and added it to "CurrencyMaster1" record.Now how can I access some of the values in the table"CurrencyMaster" in my other environment?

 

My Apex code:->

List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>([select Id, accountId, ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted']);
for(PartnerNetworkConnection network : connMap) {
PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();

newrecord.ConnectionId = network.Id;
newrecord.LocalRecordId = [select id from CurrencyMaster1__c limit 1].Id;
//newrecord.RelatedRecords = 'Contact,Opportunity,Orders__c';
//newrecord.SendClosedTasks = true;
//newrecord.SendOpenTasks = true;
//newrecord.SendEmails = true;

insert newrecord;
}

 Please advise.The documentation was less on the same.Where am I going wrong??

hisrinuhisrinu

Please read the below lines which are copied from spring 09 release notes.

 

You can now share records with multiple Salesforce to Salesforce connections. Previously, only the first connection to
accept a shared record would have access to that record. Now, multiple connections can accept and have access to the
same shared record. The Sent Connection Name field, while still visible, is no longer populated and should no longer
be used with Apex and workflow rules.