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
ThylaksoftThylaksoft 

Trigger the insertion of Data form one organisation to other organisation

In my case,i want update/insert custom object data from one organisation account to other organisation account.

 

i have used 'Salesforce to Salesforce' feature,but i am not able to trigger the insertion of data while add data in other shared salesforce object.

 

 Is it possible in salesforce?,If anybody have experienced in the above scenario ,your suggestions  are greatly appreciated!

 

 thanks in advance for your reply!!

Message Edited by Thylaksoft on 01-25-2010 04:25 AM
Message Edited by Thylaksoft on 01-25-2010 04:26 AM
Abhinav GuptaAbhinav Gupta

Did you tried going to "Connections" tab. This tab is available in "View All Tabs" or "from Setup | My Personal Information |Change my Display"

 

Here you will see a screen to establish connections between orgs and select objects to publish or subscribe. You need to select atleast one object to publish from the source org.

 

If you have already done so, then "To share a record, you must forward it to a connection using the External Sharing related list. Updates to shared records are sent automatically". For this goto the detail page of the record and check for sharing options in "External Sharing" related lists.

 

Otherwise if you want to do this via Apex Code.  Here is the snippet that explains that, use this in trigger to do so. Here is the source for this info

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_partnernetworkrecordconnection.htm 

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; }

 

  I am trying to write a complete blog post that explains this in detail. But will take some time. 

So by the time check this out and let me know if you have more queries.  

 

shaunswingleshaunswingle

I am trying to use this trigger on the Case object. I am getting an Error: Error: Compile Error: Variable does not exist: accountId 

 

Can you tell me what value should go in on this line: newrecord.LocalRecordId = accountId

Abhinav GuptaAbhinav Gupta
In this apex statement
newrecord.LocalRecordId = accountId
 
accountId variable needs to be declared, So declare accountId and initalize it with value of local org record that you want to push in another org.
 
for ex.

 

// not an ideal practice, but follow the best practices for writing triggers.

// just want to show how to declare accountId  

Id accountId = trigger.new.get(0) ;

 

 

 


Message Edited by zindalabhinav on 02-12-2010 11:18 AM