> For the complete documentation index, see [llms.txt](https://help.memberply.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.memberply.com/integrations/salesforce.md).

# Salesforce CRM integration

Sync membership applications and subsequent membership changes from Memberply to Salesforce Leads and Contacts. Review applications and make approval decisions in Memberply. Salesforce receives the latest state; it cannot approve applications or change membership access.

This integration is for Salesforce CRM, including Sales Cloud. It does not connect Salesforce Marketing Cloud Engagement, create campaigns, send emails, change marketing consent, create Accounts, or convert Leads.

## Before you start

Ask your Salesforce administrator to prepare:

* An org with Salesforce API access.
* An External Client App using the OAuth client credentials flow, with the **Manage user data via APIs (api)** scope and an assigned execution user.
* An execution user who can read, create and update Leads, read and update Contacts, and read the Organization ID. Record visibility must include all relevant Leads and Contacts for duplicate matching. Restricted visibility can hide existing records from the integration.
* Read and edit access to the Memberply fields below. Optional answer mappings also need field access.

Follow Salesforce's [client credentials setup instructions](https://help.salesforce.com/s/articleView?id=configure_client_credentials_flow_for_external_client_apps.htm\&language=en_US\&type=5). In Setup, use **External Client App Manager** to create the app, enable its OAuth client credentials flow, and configure the execution user in its policies. Obtain the consumer key and consumer secret through Salesforce's verification process. Enter these in Memberply, not in a support message.

## Create the Salesforce fields

Create these custom fields on **both Lead and Contact**, with exactly these API names. Give the execution user read and edit permission. Add fields to your page layouts if sales staff should see them.

| API name                             | Salesforce field type | Value                                                              |
| ------------------------------------ | --------------------- | ------------------------------------------------------------------ |
| `Memberply_Application_Status__c`    | Text, 255 characters  | Current application status                                         |
| `Memberply_Requested_Tier__c`        | Text, 255 characters  | Tier currently selected for the application                        |
| `Memberply_Membership_Status__c`     | Text, 255 characters  | `active`, `inactive`, or `not_a_member`                            |
| `Memberply_Membership_Tier__c`       | Text, 255 characters  | Current active membership tier, cleared when inactive              |
| `Memberply_Membership_Expires_At__c` | Date/Time             | Effective membership expiry in UTC, cleared when no expiry applies |
| `Memberply_Application_URL__c`       | URL                   | Link to review the application in Memberply                        |

On **Lead only**, also create `Memberply_External_Id__c` as a **Text field of 64 characters**, marked **External ID** and **Unique**. Memberply uses this identifier to avoid duplicate Leads when a delivery is retried. Do not edit it manually.

The integration uses standard fields with fixed API names. Your Salesforce administrator can also deploy Memberply's supplied field metadata and the **Memberply Integration Fields** permission set through an assisted setup.

## Connect Memberply

1. Open **Integrations > Salesforce CRM**.
2. Enter your Salesforce My Domain, consumer key and consumer secret.
3. Optionally select **Include existing applications**. Without this, only applications submitted after the first connection are included. Reconnecting retains that original start date.
4. Optionally map selected application answers to custom text fields on both Lead and Contact.
5. Click **Validate and save**. Memberply checks credentials, the Salesforce organization, and field permissions and types before saving.

Memberply encrypts the consumer secret in its database. Leave the secret blank when updating a working connection to keep the saved value. If you disconnected, enter it again. To rotate credentials, save the new key and secret. A connection cannot be switched to a different Salesforce organization while retaining existing record links; contact support to plan a separate setup.

Disconnecting stops future syncs and removes the saved secret. It does not delete Salesforce records. Revoke the External Client App in Salesforce as well if you want to revoke its authorization entirely.

## How records are matched

For a new applicant, Memberply looks for an exact email match among Contacts and unconverted Leads. It also checks its external ID on Leads.

* One match: link that record and update its Memberply fields.
* No matches: create a Lead with the applicant's available name, email, phone, business name and website.
* More than one match: stop and show `ambiguous_match`. No record is selected automatically.

For a new Lead whose form did not collect a last name, Memberply uses the email address as the last name. If business name was not collected, Company is set to `[Not provided]`. Collect these answers on your form if these placeholders do not suit your workflow.

Subsequent updates use the saved Salesforce record ID. Existing names, Company, email and phone are not replaced. If your sales team converts a linked Lead, the next changed application or membership sync follows Salesforce's converted Contact ID. Memberply never performs the conversion itself.

The integration keeps **one latest application per email address per Shopify store**. If someone submits multiple applications, the newest application supplies the application fields. It is not a complete application-history archive. Membership fields describe the linked member's current membership.

## Application status and membership status

Application approval does not always mean the member is active. Salesforce can receive:

* `Pending` or `NeedsInformation`
* `Approving`
* `Rejected`
* `ApprovedAwaitingPayment` or `ApprovedAwaitingApplicationFee`
* `Active`
* `ApprovalExpired` or `Withdrawn`
* `AwaitingApplicationFee`

Use **Memberply Membership Status** to determine whether membership is active. Do not treat every approved application as an active member. The expiry field represents the end of membership access, not the next recurring payment date.

## Optional answer mappings

Choose an application answer and enter the custom field API name for both Lead and Contact. The destination fields must already exist and be writable text, text area, email, URL or phone fields. There is a limit of 20 mappings. Use text fields for lists and yes/no answers; these are sent as text, not as Salesforce picklists or checkboxes.

Only selected custom answers are sent. Standard contact details are sent when creating a Lead, and the standard Memberply fields are always synced. Private reviewer notes and business-verification responses are not sent. Do not map answers into fields owned by other automations unless those systems are intended to share them. A blank mapped answer clears its destination field; removing a mapping stops future writes but does not erase the previously synced value.

## Sync activity and errors

The background worker checks once a minute, processing up to 20 latest applications per store per pass. Larger stores take longer to complete a full scan. It also detects later membership, expiry and application-answer changes. Unchanged snapshots do not produce repeat record updates. This is eventual syncing of the latest state, not a delivery log of every intermediate transition.

The page shows up to 100 records, prioritizing errors. Click an application to review its source or a linked Salesforce ID to open the destination record.

| Code                                                                               | Action                                                                                                                                                      |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `connection_failed` / `INVALID_SESSION_ID`                                         | Check the domain, consumer credentials, enabled client credentials flow, execution user, and Salesforce policies. Save corrected settings.                  |
| `memberply_fields_missing`                                                         | Check the exact field names, types and execution user's field access on Lead and Contact.                                                                   |
| `external_id_missing`                                                              | Check the Lead external ID field is unique, writable, and marked External ID.                                                                               |
| `object_permissions`                                                               | Check Lead and Contact permissions for the execution user.                                                                                                  |
| `invalid_mapping`                                                                  | Check selected answers and custom destination field names, types and permissions.                                                                           |
| `ambiguous_match`                                                                  | Resolve duplicates in Salesforce and retry, or enter the intended Lead/Contact ID and click **Link record**. Confirm the ID belongs to the applicant first. |
| `FIELD_CUSTOM_VALIDATION_EXCEPTION` / `REQUIRED_FIELD_MISSING` / `STRING_TOO_LONG` | Ask your Salesforce administrator to review validation rules, required fields and field lengths. Correct the source or destination setup, then retry.       |
| `DUPLICATES_DETECTED`                                                              | Review the Salesforce duplicate rule and existing records. Link the correct record rather than disabling duplicate protection.                              |
| `NOT_FOUND`                                                                        | The linked record may have been deleted or access revoked. Restore access or explicitly link the correct replacement.                                       |
| `REQUEST_LIMIT_EXCEEDED`                                                           | Allow Salesforce's quota to recover. Memberply defers retries; large imports can take longer.                                                               |
| `organization_changed`                                                             | The credentials identify a different Salesforce organization. Restore the original connection or contact support.                                           |
| `service_not_configured`                                                           | Contact Memberply support.                                                                                                                                  |

Temporary record failures are retried with increasing delays, up to 12 attempts for the same snapshot. Salesforce retry delays are respected. Invalid fields, duplicate matches, and other permanent errors need correction and a manual **Retry** or **Link record** action. Connection-level failures are checked again after a delay. A retry resends the latest data; it does not repeat the application decision or membership change.

Test your Salesforce validation rules, record visibility and automations with sample applications before enabling a large existing-application sync.
