Obama '08

               
   

Go Back   Mike Simonds > Salesforce > Salesforce Coding Discussions

This is a discussion on Data Sync within the Salesforce Coding Discussions forums, part of the Salesforce category; Hi, I'm a beginner in terms of Salesforce and I would like

Reply
 
LinkBack Thread Tools Rate Thread
  #1  
Old 05-19-2008, 11:43 PM
Junior Member
 
Join Date: May 2008
Posts: 1
Data Sync

Hi, I'm a beginner in terms of Salesforce and I would like to know what would be the best way to sync data between Salesforce and a remote MySQL database. I would like to be able to edit data on both Salesforce and MySQL. I am aware of sync issues ie: entry edited on Salesforce and MySQL at the same time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2  
Old 05-20-2008, 08:04 AM
Administrator
 
Join Date: May 2007
Posts: 248
Send a message via AIM to mike Send a message via MSN to mike Send a message via Yahoo to mike Send a message via Skype™ to mike

DC,

First off thanks for joining the site. I noticed that you also added me as a contact on your IM, please contact me any time!

Your question is one that I get asked a lot and will try and answer to the best of my ability.

Syncing between a local database, whether it be Oracle, MySQL, or some other DB is something that you have to really put into a think tank. You have to visualize what you want to accomplish. What I will try and do is explain how I do it and see if it maybe a way for you to accomplish your task at hand.

When you say sync, and I think I read a post of yours on the Salesforce Developers forum - do you want to sync both ways?

If you need to build a Schema for your MySQL Database, try my MySQL tool:

Here's what I have in place:

Script 1:

In this example I will use the Account object, a script that runs twice a day on CRON that connects to Salesforce via the API. Then it runs a SOQL query and performs extractions. I download all fields from a given object. I query 1000 records, insert those records in the DB, get the next set of 1000 records and insert those into the DB, and so on, and so on.

Script 2:

This is the script that performs the sync between Salesforce and my local DB. You can run this via CRON. You write whatever query you want too to gather the data needed to either update, insert or upsert (a Salesforce built in tool that allows you to updated/insert based on a "external field" that you set on a custom field in an object. We use it on a text field that I created which is an Id that is assigned to accounts, an example: 4321 is the account_id of Cheveron. The upsert function in the API checks to see if this account_id is already in Salesforce and if it is not, it creates it. If it is already in Salesforce, it updates it; hence the word upsert.

I am not sure if this gives you a start, but I would be glad to talk to you more about what it is you are trying to accomplish. If you are trying to do a live sync between Salesforce and MySQL, well there are some options there, but it would be a whole lot more difficult to accomplish > Using Salesforce Outbound SOAP Messages with PHP

Let me know if that helps and I will try and help you out as much as I can


~Mike

If you are wanting to accomplish a live MySQL database update on a record when something is updated in Salesforce, you would be wanting to look at the outbound messaging. I added a schema that I created from a developers account using my MySQL tool to build a schema!
Attached Files
File Type: sql salesforce_mysql.sql (57.4 KB, 61 views)

Last edited by mike; 05-20-2008 at 08:21 AM. Reason: Added MySQL schema
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
database sync, mysql, salesforce, sync

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin


SEO by vBSEO 3.2.0 RC8 ©2008, Crawlability, Inc.

1 2 3 4 5