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
PeelyPeely 

Help with salesforce to salesforce Apex Trigger

I'm trying to Forward an Opportunity to a connection, based on it reaching a certain stage. I have the first part of the code working, (yes it was very easy :)).

 

for(Opportunity opp: Trigger.new){

if (opp.StageName == 'Closed Won')

  opp.OwnerId = '00530000001YYX2' ;

 

 

}

} 

 

But now I'm trying to unpickle how S2S works internally. How do you forward a record to a connection programatically? 

Best Answer chosen by Admin (Salesforce Developers) 
tlaportetlaporte
Check out the PartnerNetworkConnection and PartnerNetworkRecordConnection objects.  It's a matter of inserting the record IDs into the latter, using the connectionId found in the former.  The docs @ object ref are decent.

All Answers

tlaportetlaporte
Check out the PartnerNetworkConnection and PartnerNetworkRecordConnection objects.  It's a matter of inserting the record IDs into the latter, using the connectionId found in the former.  The docs @ object ref are decent.
This was selected as the best answer
PeelyPeely
awesome.. thanks. I've taken a look at the sample code and it looks pretty straight forward.