Conditional Mapping: Using A Field on Another Object

Goal:

In this article, we'll guide you through the process of transferring a field on the company record to the contact record. You can use the same techniques on any other objects that exist in the same one:many relationship, such as:

Company:Opportunity

Company:Ticket

Contact:Opportunity

Contact:Activity

Opportunity:Order

In this example, we'll be integrating Hubspot and SugarCRM, and we'll move the "Type" field from the company record to the contact record so that only contacts attached to company of type "Prospect" and "Press" are transferred to Hubspot.

Why would you want to use this configuration? Bedrock Data lets you set up filters, workflows, and conditional mappings based on fields that exist directly on the object you're mapping. Therefore, if you want to add a condition based on a field on a related object, the first step is to transfer the data down to the base object. For example:

You want to sync contact records to your marketing system only when they belong to a company with type "Prospect" or "Target".

You want to sync opportunities to your fulfillment system only when the company is in the industry "Business Services".

You want to transfer marketing activities to your sales system only when the marketing lead has status "Sales Qualified."

Definitions:

Base Object: the data type that you are configuring an integration for. If you are setting up a contact mapping, the contact object is your base object. If you are setting up an activity mapping, the activity object is your base object.

Related Object: the object that exists in a one:many relationship with your base object, and which you are trying to grab data from. The company object is related to both the contact object and the opportunity object in a one:many relationship.

Transfer Object: The object that corresponds to your base object in your integrated system. In this case, the base object is SugarCRM's contact object, and the transfer object is Hubspot's contact object.

Directions:

Configure your Systems

Add custom fields to base and transfer objects.

We recommend that you add custom fields to your base object and transfer object so that it's easy to understand where information is originating. In the example below, we've added custom fields to the Sugar Contact and Lead (the base objects) that we've titled "Company Type." We've also added a custom field to Hubspot contacts titled "Sugar Company Type."

Step 2: Create and populate a basic contact mapping.

A modal will pop up. Select "Contact Mapping" from the "Data Type" drop-down menu. Add a descriptive title that will help you remember what conditions this mapping is using, then click "Save."

An empty contact mapping will be created. There will be an error message telling you that you need to review this mapping; don't worry, we're getting there! Click anywhere on the mapping to enter the edit screen.

Your empty mapping will look something like this. Click "Auto-Match Fields" to get a jump start on mapping your data.

Step 3: Add your conditions fields to the mapping.

Now, we need to add the mapping that will transfer the field information from the company record to the contact record. Click one of the blue "+ Add Field" buttons to open the mapping modal.

Add a descriptive label (here, "Company Type") and map fields. You'll want to add first the field from the related object (here, the object is "contact > account" and the field is "type") and next the destination field on the base object. Since Sugar has both contacts and leads, you'll want to map both of them, as below. We're using the Company Type field on the contact and lead record, but you can use any standard or custom field that you like.

While it's not required, we strongly recommend that you also map this information to a field on the transfer object. This will help you keep track of where the data is originating and will also allow you to see if it has changed since your initial sync created this record. In this case, I've added a custom field to the Hubspot contact record called "Sugar Company Type." Click "Save" when you're done.Did you know? If you didn't already have an appropriate destination field set up, no worries. Head over to your integrated systems to add the fields you need, then come back to Bedrock Data. All you need to do is click the "Refresh field info" button and your new fields will be available for mapping.

If there are additional fields on the company that you'd like to transfer data from, repeat these steps as needed.

Step 4: Add additional standard and custom fields to your mapping.

If you have any additional fields that you'd like to map between the contact objects, follow the steps above to add them. Here's an example for Job Title. You generally do not need to add any information to the "Read Only" or "Default Value" fields, but if you need a hand, just contact our support team!

Step 5: Add your relationships to the mapping.

Don't worry, we're not getting personal. Relationships are what Bedrock uses to define how objects, well, relate to each other. In this case, we need to tell the integration that Sugar leads, Sugar contacts, and Hubspot contacts all have the same relationship to companies. Click the "Relationships" tab above your mapping title and then click the "Auto-Match Relationship" button.

Boom. You're all set. (Wouldn't it be great if getting a date was this easy?)

Step 6: Add your conditions to this mapping.

Here's where we get to the fun part! When you add a condition to a mapping, that mapping only "activates" when a record is updated that matches the condition. We're going to add the "Company Type" field as a condition so that only contacts that belong to companies with type "Prospect" or "Press" will be transferred to your Hubspot instance.

Click the "Conditions" tab above your mapping title. You'll see the default mapping, which allows all contact records to pass through and use this mapping.

Follow the example below to set up your conditions. Use the plus sign at the end of the row to add a new row (or the minus one to remove a row if you got overenthusiastic on the plus-ing). Save when you're finished. For systems like Sugar or Salesforce that have both leads and contacts, you'll want to include both.

Careful! The "Any" versus "All" dropdown can cause unexpected results if you're not careful. "Any" means that a record has to match only one of the conditions to pass through, while "All" means that it must match every single one. Think carefully about how you need to structure your conditions in order for your data to be handled correctly, and contact our support team for help if you're not sure.

Add A Data Transfer Mapping

The conditional mapping you just completed will only affect contacts that already have the description set to "Prospect" or "Press." We also need to create a mapping that transfers the data from the company record to the contact every time a user updates the "Type" field on a company record or any field on a contact record in Sugar. This mapping will also update existing Hubspot contacts with the Company Type, but it won't ever create a new Hubspot contact.

Step 1: Create a new contact mapping

Select "Contact" from the data type dropdown and update the title to something that will help you remember what this mapping is doing. Click "Save."

Step 2: Add your transfer fields

Click one of the "+ Add Field" buttons to add a new field, and set up a field mapping to transfer the "Company Type" information to the "Description" field, as you did earlier. We're also going to set this field to update Hubspot contacts as well, so that it's easy for you to identify and delete Hubspot records that no longer match your conditions.

That's it! Since this mapping is only moving data between existing contacts and companies in Sugar and Hubspot, we can map this field alone. Did you know? Bedrock Data will never delete data or records from any of your integrated systems. This mapping will make it easy for you to search for and remove Hubspot contacts that are no longer relevant to your marketing process.

Step 3: Add your relationships

As in Step 5 above, you'll want to click to the relationships tab and hit "Auto-Match Relationships".

Step 4: Add your conditions

Nope! You do NOT need to add any conditions to this mapping. You want this mapping to run every time a contact record is updated. Again, this mapping won't create any new records in either Sugar or Hubspot; it will only transfer the company data down to the contact record.

Important!

This mapping must be the last contact mapping that runs. Bedrock Data checks mappings in order, so make sure that this one is at the END of the list on the mappings page.

Results:

The mapping you just set up will only create contacts in Hubspot when they belong to a company with type "Prospect" or "Press". Every time you update a contact record, sync will need to run twice before the record shows up in Hubspot: once to transfer the company data down to the contact record, and once to actually transfer the record to Hubspot.

When you add a new contact to a company that meets the conditions, the next sync run will update that contact record with the company type; the run after that will transfer it to Hubspot.

Company created in SugarCRM:

Contact created in SugarCRM; no company type populated.

After the first sync run, the company type has been automatically populated.

When you change a company type in Sugar to meet the conditions, the next sync run will update all contacts (including existing contacts) that belong to that company with the new company type; the run after that will transfer them to Hubspot.

Company exists in SugarCRM with type "Competitor".

A new contact is added to that company. Company type is not populated.

After the first sync run, the company type has been transferred from the company to the contact. The contact does not sync to Hubspot since it does not meet conditions.

The company type is manually changed in SugarCRM to "Press."

After a sync run, the company type has been updated on the existing contact.

After a second sync run, the contact is transferred to Hubspot since it now meets conditions.

When you change a company type in Sugar to not meet the conditions, the next sync run will update all contacts that belong to that company with the new company type in both Hubspot and Sugar.This will allow you to search Hubspot for contacts that don't have the right company type and delete them manually.

A company exists in SugarCRM with type "Prospect." This value has been synced to a contact record in both SugarCRM and Hubspot.

The company type is manually changed to Customer in SugarCRM.

After a sync run, the company type has been updated on the contact in both SugarCRM and Hubspot. You can now search for the contacts in Hubspot to delete them.