Question
How do I initiate a sync from Salesforce based on a formula field update?
Answer
A known limitation of the Salesforce integration is that an update to a mapped formula field in an account, a contact, or a lead doesn't trigger a synchronization to Zendesk. This causes an issue if you use a formula field to sync the values of Salesforce lookup fields as described in Salesforce: Syncing lookup field information to Zendesk Support. This sync issue is caused by a limitation in the Salesforce Streaming Events API, where changes to formula fields don't lead to the creation of a streaming event.
To solve this, create an automated process, or Flow, in Salesforce using a new hidden field that automatically updates when one of your key Salesforce fields changes.
There are three parts to this solution. First, create a new checkbox field in Salesforce to use as a hidden sync trigger. Secondly, create a corresponding checkbox field in Zendesk and add it to the sync mapping. Finally, create a flow using the Salesforce Flow Builder to automatically update the new checkbox field.
To create the new field in Salesforce:
- Go to Object Manager and select the object type you want to sync
- Go to Fields and Relationships and add a new field
- Choose Checkbox for the data type and give it a name. For example, Formula Fields Updated. Leave the default option unchecked.
- Select the appropriate field-level security, and ensure that system administrators have access to the field
- On the layouts settings page, uncheck all options. This field is only used in a background process and shouldn't be on the page for users to update.
To create the corresponding field in Zendesk and update the mapping:
- Open the User fields page or the Organization fields page, depending on whether you sync to organizations or users
- Add a new checkbox field. Name the field something that indicates that it's only used for Salesforce sync purposes. For example, Salesforce internal use only.
- Add the new field to the Salesforce mapping. Follow the instructions in Configuring Salesforce Contacts or Leads to Zendesk users sync.
- In the mapping section, add a new mapping for the new Salesforce checkbox to the new Zendesk checkbox and save the configuration
To create a flow in Salesforce:
- Go to Setup > Platform Tools > Process Automation > Flows and select New Flow
- Choose the Record-triggered Flow:
- Select an object whose field changes will trigger this flow (Account, Contact, or Lead) and specify that you want this flow to run when A record is updated:
- From the drop-down menu Conditions Requirements, select Any Condition is Met (OR). Add any conditions needed for each relevant field. This won't be the formula field itself, but rather the field on which the formula field is based.
For instance, if you have a formula field called Account Manager Name that's mapped in Admin Center, the flow should respond to changes to the Account Manager field, which is the lookup field on which the formula is based:
For each field you'll include the field on the left, the Operator Is changed and the value of True. - After you add conditions, under Optimize the flow for choose Fast Field Updates or Actions and Related Records, and click Done.
- Within the Flow Builder itself, click the plus icon to add a new element:
- Choose Update triggering record:
- Create an action that checks the Checkbox field created earlier in this guide:
- Repeat steps 7 and 8 but this time create an action that unchecks that box:
- Your finished flow should look like this:
- Save and activate the flow
Update one of your lookup fields in Salesforce and check if the account, contact, or lead syncs over to Zendesk as you expect.