Assigning a Call to the Same Agent

If you have Salesforce integrated with Talkdesk, you can easily assign an incoming call to an agent who has previously dealt with the same caller. One of the simplest ways to do this is by matching the phone number the caller is using with the phone number associated with a case in Salesforce. The caller will then be connected to the agent who owns the case. If there isn’t a match, the call can be directed to a general support line, for example.

Please follow these instructions to route a call to the owner of a case in Salesforce based on the phone number of a caller:

  1. Open the Incoming Call componentcomponent - Components are the basic building blocks of a call flow. There are multiple components available that you can add and configure to suit your needs. Check the full list of available components in the "Studio Components" section of this guide. and select the Preferences tab.
  2. Click on the drop-down next to "source_phone" and then on Create variable.
  3. Give a name to the variable. It will store the phone number that called your contact center. We’ve named it “contact_phone”.
  1. Select the Exits tab and add the Salesforce data dip component.
  2. Open the Salesforce data dip component and paste the following query:
SELECT Id, Owner.Email, CreatedDate FROM Contact WHERE Phone = '%{current_flow.contact_phone}' OR Fax = '%{current_flow.contact_phone}' OR MobilePhone = '%{current_flow.contact_phone}' OR HomePhone = '%{current_flow.contact_phone}' OR OtherPhone = '%{current_flow.contact_phone}' OR AssistantPhone = '%{current_flow.contact_phone}' ORDER BY CreatedDate DESC LIMIT 1

Note: If you have given a different name to your variable (step 3), replace all instances of “contact_phone” with the name of your variable.

  1. Click on Retrieve Data.
  2. Click on the Owner.Email drop-down and add a new variable with the name “case_owner”. This variable will store data if there is a match between the phone number used to call the contact center and the phone number associated with a case in Salesforce.
  1. Open the Exits tab and add the Conditional statement component under the “Ok” section.
  2. Under “No Result” add the Assignment and dial (A&D) component and name it “Route to General”.
  3. Select “Route to General” from the “Error” and the "Timeout" drop-downs.
  1. Open the Conditional statement component, and select the Exits tab.
  2. Use one of the buttons All or Any the drop-downs in the first “Exit” to create the condition below. Either one of these buttons can be selected, since we're only creating one condition.
case_owner is Not Empty
  1. Under “Send to” add a new Assignment and dial (A&D) component and name it “Route to Owner”.
  2. Under “No Match”, direct the call to “Route to General” (A&D component).
  1. Open the A&D component named “Route to Owner”.
  2. Select Agents as the assignment type.
  3. Under “Select how to find agents”, choose Variables in the flow context and select "case_owner" from the list.
  4. Complete the configuration of this and the remaining components.
  5. Save your flow.

From now on, if the phone number calling your contact center exists in a Salesforce case, the call will be routed to the agent who owns the case. If it doesn’t exist, the call will be directed to a general support line.