# Salesforce Sales & Service Cloud

{% hint style="success" %}
**Available for:** Preference Management Platform (PMP)&#x20;

**Premium Feature:** Salesforce Sales & Service Cloud
{% endhint %}

Didomi offers one single integration with Salesforce products Sales and Service Cloud to ensure an accurate end to end experience from leads to contacts.

This integration lets you update your lead and contact attributes with the preferences collected through your preference management platform (PMP).

{% hint style="info" %}
Alternatively, the Salesforce Sales & Service Cloud integration can be performed directly from the Didomi console for the Preference Management Platform (PMP).&#x20;
{% endhint %}

## Implementation

### **Connection**

Didomi connects to Salesforce on your behalf through the following parameters:

* Instance
* Client ID
* Client secret

### **Options**

**Upsert mode**

You can choose allowing Didomi to create leads/contacts in Salesforce, by setting `upsert_mode` to true. Otherwise, when a consent is collected but the `organization_user_id` value does not match with any lead/contact in Salesforce, the consent update will not be propagated.

**Bidirectional flow**

Please note that the bidirectional flow is not supported at the moment.

### **Mapping**

Didomi uses both lead and contact entity of Salesforce.

* First you need to tell Didomi whether you want Leads or Contacts to be updated
* Then you can set up the mapping between lead OR contact attribute and Didomi's preferences

Hence consent events are mapped to either contact attributes OR lead attributes in Salesforce.

If you want to sync both leads and contacts at the same time, you need to create 2 separate configurations for your organization.

{% hint style="warning" %}
**Note**: In order to ensure that events are received, Didomi will retry at least five times in the span of five minutes before moving on when your endpoint is down.
{% endhint %}

## Configuration

| Property          | Description                                                                                          | Required                  |
| ----------------- | ---------------------------------------------------------------------------------------------------- | ------------------------- |
| URL               | The URL of the Salesforce domain                                                                     | Yes                       |
| Client ID         | The consumer key of the connected app                                                                | Yes                       |
| Client secret     | The consumer secret of the connected app                                                             | Yes                       |
| Salesforce Object | Entity to be synchronized with Salesforce. Options: `Account`, `Contact`, `Lead`.                    | Yes                       |
| Upsert mode       | By setting upsert\_mode to true you allow Didomi to create accounts, leads OR contacts in Salesforce | No, Default value = false |
| Mappings          | Mapping for properties between Didomi and Salesforce                                                 | Yes                       |

### Example

```javascript
{
    "type_id": "sf-sales-cloud",
    "authentication": {
        "url": "your_rest_api_endpoint",
    	"client_id": "your_client_id",
        "client_secret": "your_client_secret"
    },
    "properties": {
        "sobject": ["Lead"]
    },
    "mappings": [
        {
	    "id": "contact_attribute_id", // Salesforce contact ID
	    "value": "tFyHkpl" // PMP widget ID of a preference
	    "type": "pmp-widget-id"
	}
    ],
    "upsert_mode": true
}
```
