Remote Fields | CRM

How to view metadata on all fields from a CRM integration, and push values for custom fields

Prannoiy Chandran avatar
Written by Prannoiy Chandran
Updated over a week ago

Overview

Please go to Remote Fields | Overview for an introduction to the feature and its concepts

Note: This feature is currently supported for select CRM integrations (Hubspot, Salesforce and Pipedrive).

To watch a demo of this feature in action:

Example: Remote Fields on the CRM Contact Model

Pulling Remote Field Metadata

For this example, we will use custom fields set up on the Contacts model on Hubspot, which is mapped to the Merge Contact model.

We can access this linked account’s Remote Field Classes for Contacts using this endpoint: GET https://api.merge.dev/api/crm/v1/contacts/remote-field-classes

The two remote field classes below are both custom fields defined by a Hubspot user, as we can tell from the is_custom flag being set to True. The test_dropdown_custom_field also has a list of accepted values under field_choices.

Meanwhile, these two remote field classes are standard fields from Hubspot, as the is_custom flag is set to False.

Pushing Remote Field Values - For Custom Fields

There are two key pieces for writing to custom fields using Merge:

  • The Merge ID of the remote field class

    • You will retrieve this from the /remote-field-classes endpoint for that model

  • The value that you want to push to the third-party for that field

When sending a POST request to https://api.merge.dev/api/crm/v1/contacts, these data points should be included in the request body under the remote_fields array as shown below:

You can use the following request body as a template for your POST request:

{ "model": { "account": null, "addresses": [], "last_name": "Feig", "first_name": "Gil", "phone_numbers": [ { "phone_number": "+1234567890", "phone_number_type": "Mobile" } ], "email_addresses": [ { "email_address": "[email protected]", "email_address_type": "Work" } ], "last_activity_at": null, "integration_params": null, "linked_account_params": null, "remote_fields": [ { "remote_field_class": "462f9400-a1d7-4868-b45a-f18cc9dc4b3d", "value": "Test String" }, { "remote_field_class": "f240d198-1fed-4ef5-9634-198baee92c6c", "value": "Option 1" } ] } }

Once your POST request is successful, you can access the remote field metadata and values for the contact you just created by sending a GET request to this endpoint: https://api.merge.dev/api/crm/v1/contacts/{id}?include_remote_fields=True

If you would like to access remote field metadata and values for all contacts available in the linked account, you can send a GET request to the list endpoint: https://api.merge.dev/api/crm/v1/contacts?include_remote_fields=True

Where applicable, you will also be able to see the custom field values you just wrote to the third-party on the relevant UI, as shown in this example from Hubspot:

Did this answer your question?