# Syncing from Postgres to Salesforce - Data Mappings

DevFeed: [Syncing from Postgres to Salesforce - Data Mappings](<https://devfeed.tech/articles/syncing-from-postgres-to-salesforce-data-mappings-41192.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2016/11/23/syncing-from-postgres-to-salesforce-part-1/>)

Author: Map

Published: 2016-11-23T20:55:56Z

Content type: tutorial

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [Software as a service](<https://devfeed.tech/topics/saas.md>), [Database](<https://devfeed.tech/topics/database.md>), [data](<https://devfeed.tech/topics/data.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>), [Software](<https://devfeed.tech/topics/software.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [crm](<https://devfeed.tech/tags/crm.md>), [data](<https://devfeed.tech/tags/data.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [salesforce](<https://devfeed.tech/tags/salesforce.md>), [syncing](<https://devfeed.tech/tags/syncing.md>)

## AI overview

A tutorial on syncing data from a Postgres system of record into Salesforce for SaaS and B2B applications. It explains Salesforce data models, mapping internal users and customer information, and building the integration with example code.

## Source excerpt

For the second time now I've had to implement a system that syncs from my system of record into Salesforce.com, the first at Heroku and now at Citus Data. The case here is pretty simple, I have a software-as-a-service, B2B product. It's a homegrown application in these cases in Ruby, but could be Python, .Net, any language of your choosing. The problem is I don't want to have to be rebuilding my own CRM, reporting, etc. on top of all of my internal database. And as soon as you're at some reasonable size (sales guy of 1 or more) you need to be able to provide insights on what's in that system of record database to others. While my tooling isn't a full fledged product by any means, here's a bit of how I've developed this process a few times over and some of the annoying bits of code to help get you started. In this post I'll walk through some of the basic datatypes, then we'll follow-up with the overall architecture and tweaks you need to make to Salesforce, and finally we'll provide some example code to help you create this setup yourself. Leads, Contacts, Accounts oh my Despite being some of the largest as-a-service vendors in the world, Salesforce is still primarily setup for traditional high touch sales. What this means is some of the data you'll commonly have, or in this case not have, can make it difficult to figure out what maps from your internal system to Salesforce. Within Salesforce there's really 4 key data models you're going to care about. Lead vs. Contact In every as a service product you'll have some user that creates and account which usually has an email address tied to it. This seems simple enough to load up to Salesforce as there is a clear email field. Within Salesforce there are two key data types which have a default field for this lead and contact, in Salesforce terms a lead is someone considering doing business with you, a contact someone who more so is doing business with you. If you have a freemium or timed trial model you might think to sta