PieSync Help Center

Explore our help center for quick answers

Salesforce: Copying account data to contact level

Frans Leys

Do you need to setup a sync from Salesforce data to another app and the data you need sits on the Account instead of the Contact?

The fields you can choose to sync to your other app with are only those from the contact level. Data you store on the account is not to be found in the PieSync rules or mappings. (We're working on improving this)

There's a workaround to this if you need this today. This is valid to sync data from Salesforce to your other app (continuously). You cannot expect this workaround to update fields on the other object in Salesforce. Possible scenarios?

  • you only want to sync contacts whereby the Account is from a certain Type
  • you want to sync contacts but they don't have a billing address stored, instead it is stored on the Account
  • if no phone number on the contact is available, then and only then copy over a phone number from the account

Here's what you'll need to do.

Step 1: Create fields on the contact that will take in the account data

The overall principle of this workaround is that we will set up formula fields on the Contact object that replicate the Account fields that we need. Go to the Salesforce object manager and update the contacts object. Hit 'New'.

You need to make this a formula field. It's a formula since we will rely on Salesforce formula's to take in information from another related object and copy it on the contact record.

Choose the format the field will take on the contact level. When in doubt? Choose text. From a Salesforce POV it doesn't really matter that much, since we won't actually make this field visible on the contact layout. But you do want to keep in mind what PieSync rule you'll construct out of this.

You also need to give it a label. I would suggest you name it something like "Account ...." for easy reference.

Now we get to defining a formula which is easier than you may think. Hit "Insert field".

Browse to the field on the Account that you need. In this example, I'm taking the industry which is a value stored on Account. Hit next.

When Salesforce returns an error like ... Picklist fields are only supported in certain functions, you will need to tweak your formula by prefixing your formula with TEXT and putting the field in between round brackets.

Need to copy over address fields? Those are composite fields and you can spread them out over different lines with BR() codes. For instance, if you want to bring the billing address down the contact level too, copy this text Account.BillingStreet & BR() & Account.BillingCity & BR() & Account.BillingState & BR() & Account.BillingPostalCode & BR() & Account.BillingCountry

You can get creative with formulas. When you know certain contacts don't have a phone number referenced, but their account does, you can create a fallback number. The following formula is what I have behind a field named "Fallback Phone". IF( ISBLANK(Phone), Account.Phone , Phone )

This formula first looks at whether a specific phone number for the contact is available, and only if it isn't, it goes and fetches the general phone on the account instead. This way, when you sync Salesforce contacts to Google Contacts, you are more likely to have a phone number referenced.

Step 2: Create a process flow

PieSync's engine relies on an update of the "last modified timestamp" on the contact. The information that we just copied over to the contact can now be read into by PieSync, however, updating it on the account level doesn't make PieSync detect those updates. In fact, PieSync's engine relies on an update of the "last modified timestamp" on the contact. That's where setting up a process flow with the Process Flow Builder comes in.

This is necessary so that any updates you make also give a little update - a nudge so you will - to the underlying contact. The Process Flow is going to be a very easy one.

Create a new process by giving it a name. You'll want to do this so you remember why you did this when in 2 years you stumble on this page again.

We're going to keep this process very simple. This process flow will run each time an Account is created or edited, so that's exactly what we're putting in the fields it's asking for.

Next step - criteria. We want this process flow to run whenever the fields that we are copying over actually change. You can potentially set this to "No criteria - just execute the actions" too.

Under action, we need to force a change on the contact. Choose the action "Update records" and refer to the Record type of Contacts. Here, since I'm never using the business fax number anyhow, I'm updating that fax value with a random number.

Activate this process flow.

Step 3: Now you can set up those field mappings in PieSync!

The rules will allow you to refer to filter out contacts that only have a certain value on the account. You refer to the field on the contact, but based on the steps you completed above the information is actually coming from the account.

And it also works in the mappings!

On this page