Retrieving customer details through telephone number

Retrieving customer details using telephone number
Follow the steps below to retrieve a customers details from a database/spreadsheet using the phone number the customer called from.
This functionality can only be achieved when numbers are dialed through directly.
Depending on telephony set-ups, numbers diverted or re-routed cannot be displayed as this method uses [var_cli], which will be populated by the telephony platform.
If you're happy to fore-go a direct input from phone number, details can also be set by confirming a piece of identifiable information (Telephone number/Postcode etc).
**Please note all database/script names creates in this tutorial are interchangeable, and are not required to be exactly as they have been written here. 
1. Create a database in SQL Server Management Studio, using the instructions found in the related Knowledge Base article.
2. In CallScripter create a script as usual.  In this example 4 pages, including one with Text Boxes to show the customer details, have been created and linked:
 3. Add Text Boxes or similar to the script page to map the data from the database to:
To retrieve details based on the incoming phone number, continue to step 4
To allow agents to search manually, move to step 10
4.  Start by adding a script variable var_CLI.  Once this is added to the script it will populate automatically from the telephony integration.
5. Add an External Data Source control to the page. Configure the Advanced Properties to select Microsoft SQL Server as the datasource.  Enter the appropriate SQL server and authentication details as necessary.
        Select the new 'Customer Details' database, and test the connection.
6.  Write the SQL query. As just the telephone number will be used to search, the query is likely to look as follows:
 By mapping directly to [var_cli], if the variable has been populated by the telephony integration, and providing the correct format of the phone number has been followed, the query will return all results with a telephone number that matches the callers number.
7. Add a test value identical to one already stored in the database for CallScripter to test against, wrapped in apostrophes. 
8.  Map your fields as required. Save and close the advanced properties, and set the Data Source to 'Hide Button' and Auto Click' to 'Page Load'
9.  Test the script to ensure it works as expected:
Follow from here to allow your agents to search for Customer Details
10. On the Start Page create a field that will contain the information to search by. For this example, we'll use telephone number. 
11. On the details page insert an External Data Source control. In the control properties opt to show the button, and set the autoclick to never. From 'Used Controls' add the 'CustomerPhone' text box to the page.  This will auto populate with the information the agent entered on the first page. By allowing the agent the ability to click to populate the details, they will be able to edit the phone number should they need to. 
12.Configure the External Data Source advanced properties to use 'Microsoft SQL Server' as the Datasource.  Enter the appropriate SQL server and authentication details as necessary.  Select the new 'Customer Details' database, and test the connection.
13.  Write the SQL query. As the telephone number will be used to search, the query is likely to look as follows:
14. Insert a test value identical to a test value in your database (this needs to be a value from the data being searched from - so in this example, a telephone number is used as a test value):
15. Map the fields, and check 'overwrite' against the fields to be displayed to the agent. This will allow them to go back and change data if required. 
16. Test the script to ensure it works as expected:
If you require any further training, contact