Question

The legacy Salesforce integration included a sync-many function. How can I do something similar using the new Salesforce integration? 

Answer 

A data sync triggers when a mapped field is updated in a Salesforce record, or if a new record is created. Updated unmapped fields do not trigger the sync. See this article for more information: Configuring Data Sync from Salesforce to Zendesk.

The legacy integration did not fire when records were created or updated, either in batches or using the Salesforce API. A manual batch-sync was required to update Zendesk for any records created or updated in this fashion.

The new Salesforce integration does not have this limitation. Batch updates and API updates trigger a sync over to Zendesk, provided one of the mapped fields is changed. Follow this workflow to accomplish a batch-sync function, which updates many records in SFDC via the API.

Note: Syncing and the following workflow makes use of the Salesforce streaming API. As such, it is subject to their rate-limits for different plan-levels. The relevant limit will be the following: Maximum number of delivered event notifications within a 24-hour period, shared by all CometD clients. Exceeding this limit will cause the sync to be deactivated.

For information on how to check your current rate-limit usage, see the following article: How can I check my Streaming API limits and usage?

Although the following example deals specifically with account-syncing, a similar method can sync Contacts or Leads. While this explanation includes the creation of a new custom field within Salesforce, a checkbox field is not required for this method. The only requirement is that a non-formula field is present in SFDC and mapped within Admin Center, which can be modified in batches to trigger the streaming API event on which the sync is based.

Here are steps to sync many records using two built-in SFDC tools:

    1. Create a custom checkbox organization field in Zendesk called Sync with Salesforce.
      sync_with_salesforce_field.png
    2. Create a checkbox account field in Salesforce called Sync with Zendesk​ with a default value of False.
      sync_with_zendesk_checkbox.png
    3. Map the two fields to each other in the Admin Center: https://yoursubdomain.zendesk.com/admin/platform/integrations/salesforce/accounts_organizations 
      Screen_Shot_2020-01-06_at_9.17.06_AM.png
    4. Create a report in SFDC that includes two pieces of information:
      • SFDC account ID
      • The Sync with Zendesk account-field from step 2
        Screen_Shot_2020-01-06_at_11.09.16_AM.pngScreen_Shot_2020-01-06_at_11.09.24_AM.png
    5. Export the detail rows of the report from step 4 as a CSV.
      Screen_Shot_2020-01-06_at_11.10.32_AM.png
      Screen_Shot_2020-01-06_at_11.11.00_AM.png
    6. In the spreadsheet editor of your choice, update the Sync with Zendesk column of the CSV file to be the opposite of whatever it was before. If it was false, then set to true or the opposite.
    7. Import the updated CSV back into SFDC, using a tool such as Dataloader, to update all the accounts.
      Screen_Shot_2020-01-06_at_11.14.10_AM.png
      Screen_Shot_2020-01-06_at_11.14.39_AM.png
      Screen_Shot_2020-01-06_at_11.17.26_AM.png

      sfdc_dataloader.png
      Use the BATCH API and not the Bulk API for this Upsert or Update.
       
    8. After updating the SFDC records, allow some time for the background jobs to complete. This timeframe varies depending on the number of records to be synced. For a few hundred records, this might only take a few minutes. For tens of thousands of records, it might take thirty minutes to an hour.
    9. Once all records synced, remove the mapping from step 3 and delete the fields created in steps 1 and 2. Alternately, leave them in place to manually trigger a sync in the future.
Note: These steps describe the import process using Dataloader. Other Salesforce import tools can also work with the Zendesk integration. However, they must use the Batch API and not Bulk API for the import. The reason for this is that BULK updates do not generate the Push Topic events on which our syncing relies, due to this limitation of the Salesforce API. For example: at the time of this writing - the G-Connector extension does not support use of the Batch API, so updates made to SFDC records using that tool will not trigger the sync.
Powered by Zendesk