User Guide

Please email training@callscripter.com for omissions or errors.
×
Menu

JavaScript Control

JavaScript Control
 
1

Field Name

1. Field Name
Give your field an appropriate name.  This is particularly important if using it in a calculation or report.  Changing a field name will not automatically update corresponding reports that use that field.
2

Styling Button

2. Styling Button
Change the look and feel of the control.
3

Text

3. Text
Enter the text for the control as you wish it appear to the agent.
4

... button

4. ... button
Use the Advanced Properties button to enter the JavaScript code/functions.
5

Save button

5. Save button
Click to Save changes.
6

Close button

6. Close button
Close control attributes.
7

Delete button

7. Delete button
Delete control from script page.
 
The JavaScript control is most commonly used to create custom functions*.  Once the function is created and loaded on script load it is available to be called on by another control.
 
Code AND functions must be on the same script page, and both must be placed on every script page you wish to call the function.   The code is only available on a per-script page basis. The contents of a Javascript control are placed in the DOM structure of the client browser and evaluated during the script page render process. They are not executed on the Page Load event, however this can be manually coded for within the contents of the JavaScript Control.
 
To create and use code/functions on a global basis, the code must be stored in webfiles/lib/custom.js (CallScripter helper functions are stored in the same location under script.js file).  Once code is stored in the custom.js file this can be called within any script on any page.  Please ask CallScripter training for guidance.
 
 
 
* A function allows code to be created and stored under a “quick code” (function) name.  Examples of CallScripter (global) functions are suppressFields, getCSObject, etc.
 
For example:
 
Code
Explanation
function myfunction()
{
alert("Hello, this is a function");
}
Create a new function called myfunction()
Tells myfunction what code to run
 
The code will not do anything until activated by another control.  In this example a JavaScript button contains the following code:
 
 Add a JavaScript button to the page, and enter the following code:
Code
Explanation
myfunction()
Calls all the code contained with the function called myfunction