Defining callback scripts

It is possible to write your own callback scripts, using the scripting language VBScript. Using scripts provides you with the most flexibility for callbacks, but is also the most technically complex to set up, since it requires knowledge of VBScript. VBScript is a relatively easy scripting language, but you must be familiar with it before you attempt to write callback scripts.

Note: For information on how CCA determines the next contact to be called, see the Knowledge Base article Contact Selection for Telephony in CCA.
Callback scripts are run after the calculations from all other callback methods are complete. This means you only have to specify exceptions to the rules already defined using the other methods.

In this topic:

Creating a callback script

You can access the call back script window by clicking create script (or edit script, to amend a script that has already been defined) in two places:

The callback script window is re-sizable and you can copy and paste text to and from it.

View image

call_back_script_window

 

Writing your callback script

When creating a callback script, you need to either:

When you first open the callback script window, it  contains an explanation and a small script example. As is standard in VBScript, these lines begin with a single quote ('), as they are comments. A Microsoft reference page for VBScript can be found here.

The default content of the window gives a good basic explanation of how callback scripts work, and appears as follows:

' Here you can modify the regular callback behaviour.

' You can do this by modifying [Result.IsOverCallback], [Result.CallBackShift] and [Result.CallBackTime] any way you like.

'

' Some things to keep in mind:

'  - The result is initialized using the normal callback settings

'  - When changing [Result.CallBackShift], [Result.CallBackTime] will automatically be calculated

'     - If [Result.CallBackTime] is not modified, the first upcoming shift will be used

'     - Otherwise the first shift after [Result.CallBackTime] will be used

'  - You can also modify [Contact.Phone], [Contact.Email], [Contact.Priority], [Contact.AppointmentImportance] and all [ListField]'s

'  

'

'

' EXAMPLE:  Call missed appointments on the requested appointment hour (but the normal day)

'

'    If Not [Result.IsOverCallback] And [CallHistory.LastCallResult]0 And [CallHistory.LastCallResult]9 Then 'not over callback and no success or appointment

'      If [Contact.IsAppointmentTaken] Then 'appointment made in the past

'          If TimeValue([Result.CallBackTime])

'            [Result.CallBackTime] = DateValue([Result.CallBackTime]) + TimeValue([Contact.AppointmentTime])

'          Else

'            [Result.CallBackTime] = DateAdd("d",1,DateValue([Result.CallBackTime])) + TimeValue([Contact.AppointmentTime])

'          End If

'      End If

'    End If

 

Here are three further examples:

'Specific Rules for Resultcode 2 (busy) and sex (from lst)=1

If [CallHistory.LastCallResult] = 2 and [ListFields.sex]=1  Then

        'Set the callback time in 1 day running

        [Result.CallBackTime] = DateAdd("D",1,[CallHistory.LastCallTime] + [Contact.CallBackIdleTime])

End If

 

'Specific Rules for Resultcode 3 (No answer)

 If ([CallHistory.LastCallResult] = 3) Then

        'Set the callback time in 5 days running

        [Result.CallBackTime] = DateAdd("D",5,[CallHistory.LastCallTime] + [Contact.CallBackIdleTime])

End If

 

'Specific Rules for Resultcode 4 (Hang up)

 If ([CallHistory.LastCallResult] = 4) Then

        'Set the callback time in 5 days running

        [Result.CallBackTime] = DateAdd("D",5,[CallHistory.LastCallTime] + [Contact.CallBackIdleTime])

End If

Testing your script for syntax errors

It is good practice to test your script using the built-in testing tool. Note that this tool can only detect syntax errors; any logical errors (e.g. a possible, but undesired, callback rule) will not be detected, as AskiaField cannot know the intended function of your script.

To test your script's syntax:

  1. At the top of the callback script window click test.

  2. A window appears informing you whether any errors were found, or if the script is valid.

Script parameters

A list of available parameters can be viewed in the parameters drop-down list at the top of the callback script window. Click insert to place that parameter into the script window at the current insertion point.

Contact parameters
Name Description Modifiable

Contact.ID

ID of the contact in the list (also called Panel ID). (AskList.AskInterview)

No

Contact.ExternalID

ID of the contact in the external list  (AskList.AskExternalUniqueId)

No

Contact.Phone

Telephone number (AskList.AskTelephone)

Yes

Contact.Email

Email address (AskList.AskEmail)

No

 
ListField parameters
Name Description Modifiable

User-defined fields

User-defined fields which can be used on scripts.

Yes

 

CallHistory parameters
Name Description Modifiable

CallHistory.arrCallResult

Array with the call results for all calls to the current contact. See note below for further details.

No

CallHistory.arrCallSubResult

Array with the call sub-results for all calls to the current contact. See note below for further details.

No

CallHistory.arrCallAgent

Array with the agent ID for all calls to the current contact. See note below for further details.

No

CallHistory.arrCallAgentName

Array with the agent name for all calls to the current contact. See note below for further details.

No

CallHistory.arrCallShift

Array with the shift for all calls to the current contact. See note below for further details.

No

CallHistory.arrCallTime

Array with the time for all calls to the current contact. See note below for further details.

No

CallHistory.LastCallResult

Call result for the last call to the current contact

No

CallHistory.LastCallSubResult

Call sub-result for the last call to the current contact

No

CallHistory.LastCallAgent

AgentID for the last call to the current contact

No

CallHistory.LastCallAgentName

Agent name for the last call to the current contact

No

CallHistory.LastCallShift

Shift for the last call to the current contact

No

CallHistory.LastCallTime

Time of the last call to the current contact

No

 

A note on CallHistory parameters:

All CallHistory.arr* variables contain the call history for the contact from after the latest recovery and latest derivation.  For example, if the contact had two calls by agent 1, the first at 12:00 (shift 1) and the second at 15h (shift 2), all arrays would contain two elements (one for each call). For example:

arrCallResult[0] = 3 arrCallResult[1] = 0

arrCallSubResult[0] = 0 arrCallSubResult[1] = 0

arrCallAgent[0] = 1 arrCallAgent[1] = 1

arrCallAgentName[0] = "agent 1" arrCallAgentName[1] = "agent 1"

arrCallShift[0] = 1 arrCallShift[1] = 2

arrCallTime[0] = 12:00 arrCallTime[1] = 15:00

 

Configuration variables

These variables contain the callback settings from the callback settings tab; they are read-only.

Name Description

Configuration.arrMaxCallAttempts

Max attempts

Configuration.arrIsCallBackDelay

True if 'next attempt' is set to 'after'

Configuration.arrIsCallBackDelaySuspend

True if 'next attempt' is set to 'after running'

Configuration.arrIsCallBackNextShift

True if 'next attempt' is set to 'next shift'

Configuration.arrCallBackDelay

Delay (in minutes), only valid if 'next attempt' is set to 'after' or 'after running'

 

Result parameters

The following parameters are arrays containing the configuration data of all possible call results. These values are populated with the already-calculated values from the standard callback settings.

Name Description Modifiable

Result.IsOverCallBack

Set to TRUE if the contact can be called back.

Yes

Result.CallBackShift

The shift for the next call. Set to 0 or -1 to callback at CallBackTime.

Yes

Result.CallBackTime

The time of the next call. If CallbackShift is a valid value, then contact will be called back at the first available shift AFTER THIS TIME.

Yes

Create your own Knowledge Base