Controlling Toolbar Buttons with JavaScriptJavaScript 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 ToInside 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:
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:
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:
The options available to check the state of a button are:
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).
ExamplesHide 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()
}
NotesThere 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.
|