Awaken Scripting User Guide

Please email helpdesk@awaken.io for omissions or errors.
×
Menu

Controlling Toolbar Buttons with JavaScript

 
JavaScript can be used to manipulate the Toolbar Buttons at any time in a Workflow, and can allow querying of a button's state or dynamic setting of buttons on a page as a result of choices during the Page.
 

How To

Inside any JavaScript-manipulating Field (Calculate, JavaScript, JavaScript - Button), use one of the functions specified below.
 
Navigation Buttons
There are two different syntaxes to interact with the Navigation Buttons:
Script.NavigationButtons["button"].method();
Script.NavigationButtons.method("button");
 
Both syntaxes offer the same basic functionality, however the first syntax allows additional code to be added to chain methods together. For example:
Script.NavigationButtons["button"].settingMethod().checkingMethod();
 
The "button" fragments above should be replaced with the (case sensitive) names for the Navigation Buttons:
Button
Name
Home
Back
Forward
End
Transfer
Help
History
 
 
Communication Buttons
There are two different syntaxes to interact with the Communication Buttons:
Script.CTI.Buttons["button"].method();
Script.CTI.Buttons.method("button");
 
Both syntaxes offer the same basic functionality, however the first syntax allows additional code to be added to chain methods together. For example:
Script.CTI.Buttons["button"].settingMethod().checkingMethod();
 
The "button" fragments above should be replaced with the (case sensitive) names for the Communication Buttons:
Button
Name
Transfer
MakeCall
Mute
Record
Hold
Disconnect
Pickup
 
 
Setting and Checking Methods
The .method() fragment in the above sections should be replaced with one of the methods described in the following tables.
 
The options available to set the state of a button are:
Method
Description
Enable
The button will be clickable (as long as there are no other conditions preventing its use, and it is visible).
Disable
The button will not be clickable.
Show
The button will be visible.
Hide
The button will not be visible.
 
 
The options available to check the state of a button are:
Method
Description
IsVisible
Check if the button is visible.
IsEnabled
Check if the button can be enabled.
IsReallyEnabled
Check if the button is actually enabled.
 
These checking options make the function return a boolean (true/false) value.
 
The IsReallyEnabled option exists as, in some situations, Scripting may override the set status of a button. For example, the Forward button will always be disabled unless you have used the Back Button to navigate backwards in a Workflow; in this case, it would return true for IsEnabled (as it has the potential to be clickable), but false for IsReallyEnabled (as it isn't currently clickable).
 
 

Examples

Hide the Home button:
Script.NavigationButtons.Hide("Home");
 
Check if it's possible for the agent to go forward:
Script.NavigationButtons.IsReallyEnabled("Forward"); // true or false
 
Hide the Pickup button if it's not enabled:
if ( !Script.CTI.Buttons.IsReallyEnabled("Pickup") ) {
Script.CTI.Buttons["Pickup"].Hide()
}
 
 

Notes

There are two instances of the Transfer button, one existing in the Navigation buttons and the other in the Communication buttons. If using a CTI, then the Transfer button in the Navigation group is automatically removed and replaced by the one from the Communication group.
 
Checking methods must be the final element in the chain if they are used. Trying to chain a setting method after a checking method will throw a JavaScript error.