Pages

Wednesday, May 1, 2013

Salesforce to Salesforce: how is the owner in partner instance?

In previous blog, we have discuss on how to set up Salesforce to Salesforce between 2 instance. So your data can transferred to your partner Salesforce without 3rd party and complex ETL process.

A user come to me this morning, for some reason, he want to know who is the owner of the account and opportunity in partner instance, because once record transferred over to our Salesforce, the owner will be change to the connection user and no information who owned it in partner instance.

Solution:
  • In Publisher instance, create new text field called 'Corp A owner' in account
  • Write a simple trigger to populate owner name from Account to this new field
  • Publish the newly created field in Salesforce connection
  • In Subscriber instance, create the same text field 'Corp A owner' in account
  • Map it in Subscribed Objects
  • Done
Once, the data transferred over, we will know who is the owner for that account, so our Sales Rep can directly contact Sales Rep in Corp A. And, we also can use the same way to transfer over Sales Rep in our company to partner Salesforce for two-ways data sync.

Trigger reference:
trigger updateTextOwner on Account (before insert, before Update)
{
    for (Account accs : Trigger.new) {
            User u = [Select Id, Name from User where id = :accs.OwnerId];
            accs.Text_Owner__c = u.Name;
    }
}

No comments:

Post a Comment

Page-level ad