Download PDF
Download page The Javascript Tab.
The Javascript Tab
Using the Javascript tab, you can write Java code using the available predefined functions, script data, and agent parameters created for the script to function. The following section describes the use of certain script functions that appear in the Functions area of the JavaScript tab.
Functions
This section describes the Java functions used for buttons or custom JavaScript code that perform specific actions when triggered. All methods must be accessed with the prefix “lvcore
.” For example, lvcore.getAccountNumber();
returns the account number of the current call. The main functions are categorized as follows:
This section contains functions that help in managing calls and conference APIs.
Function Name | Description | Parameters |
---|---|---|
lvcore.completeConference() | An agent uses this function to complete a conference call, bringing all three parties, the agent, caller, and supervisor, onto the same call. | - |
lvcore.leaveConference() | This function is used by an agent to leave a conference call, allowing the supervisor and caller to continue on the call while the agent is disconnected. | - |
lvcore.reconnectCall() | This function is used by an agent to reconnect with a caller, returning the call to the state it was in before the agent attempted to transfer it. | - |
lvcore.transferCall(phone, extension, delay, secure) | This function transfers a call to a specified phone number or extension with optional parameters for delay and security.
| phone, extension, delay, secure |
lvcore.setPendingStatus(ready,breakCode) | This function updates the agent's status to a pending state with an optional break code.
| ready,breakCode |
This section contains functions that help in managing credit card transactions.
Function Name | Description | Parameters |
---|---|---|
lvcore.getSecureCreditCard(scriptDataHolder, showAlert) | This function is used to securely retrieve a credit card number within a script.
This function ensures that sensitive information, such as credit card details, is handled securely during the interaction. | scriptDataHolder, showAlert |
lvcore.getSecureExpiryDate(scriptDataHolder, showAlert) | This function is used to securely retrieve the expiration date of a credit card within a script.
This function ensures that the credit card's expiration date is handled securely during the interaction. | scriptDataHolder, showAlert |
lvcore.getSecureCode(scriptDataHolder, showAlert) | This function is used to securely retrieve a credit card's security code (CVV) within a script.
This function ensures that the security code is accessed and handled securely during the interaction. | scriptDataHolder, showAlert |
lvcore.initiatePaymentProcessing() | This function starts the payment processing workflow within a script. This function typically initiates the payment transactions, including validating and submitting payment details for processing. | - |
lvcore.checkCreditCardField(fieldName) | This function validates the specified credit card field within the script.
This function ensures that the specified field meets the required format and validation criteria for processing. | fieldName |
lvcore.checkCreditCard(cardnumber) | TThis function verifies the validity of a provided credit card number.
This function validates the format and authenticity of the credit card number to ensure it meets the required standards for processing. | cardnumber |
lvcore.getCardType(creditCardNumber) | This function determines the type of credit card based on the provided credit card number.
This function identifies the card type (for example, Visa, MasterCard, American Express) by analyzing the number's format and issuing bank identifiers. | creditCardNumber |
This section contains functions that help in managing core functions.
Function Name | Description | Parameter |
---|---|---|
lvcore.checkRequiredFields() | This function validates HTML fields to ensure that they meet the necessary criteria.
This function helps ensure that all relevant data is correctly entered and formatted before proceeding. | - |
lvcore.getFormData() | This function retrieves the data entered in a form within the script. This function collects and returns all input values from the form fields, allowing for further processing or validation of the submitted data. | - |
lvcore.setFormData() | This function populates all user interface (UI) controls with data from the formData variable. | - |
lvcore.validateField(element, focus, forceMatching) | This function is used to validate a form field based on several criteria.
This function ensures that the field meets validation rules, such as correct format, required value, or matching another field, and can optionally focus on the field if it does not pass validation. | element, focus, forceMatching |
lvcore.fireApiRequest(apiName, requestName) | This function initiates an API request within the script or application.
This function triggers the specified API call, allowing you to execute operations or retrieve data from an external service or system based on the provided parameters. | apiName, requestName |
lvcore.validateAddress(scriptDataName,value) | This function validates an address field within the script.
This function ensures that the provided address meets the necessary format and validation criteria, specifically for US postal addresses. It helps to verify the accuracy and completeness of address data within the script. | scriptDataName,value |
This section contains functions that help in managing the get functions.
Function Name | Description | Parameter |
---|---|---|
lvcore.getAccountNumber() | This function retrieves the account number associated with the current call or session. This function accesses the customer's account number to process or display it within the script or application. | - |
lvcore.getAgentInfo() | This function retrieves information about the current agent, such as their ID, name, or other relevant details. | - |
lvcore.getCallSessionId() | This function retrieves the session ID for the current call. | - |
lvcore.getOriginalAgentInfo() | This function retrieves information about the original agent who first handled the call or session. | - |
lvcore.getScriptSessionId() | This function retrieves the unique session ID for the current script session. This ID is used to track and manage the script session, ensuring that all actions, data, and interactions within the session are properly logged and associated with the correct instance of the script. | - |
lvcore.getScriptData(key) | This function retrieves specific data from the current script session using a provided key.
This function allows you to access and use specific pieces of data stored in the script session, facilitating data retrieval and manipulation based on the given key. | key |
This section contains functions that help manage the main functions.
Function Name | Description | Parameter |
---|---|---|
selectContactCallback(contact) | This function is a callback function that processes a selected contact.
This function handles actions or logic that should occur once a contact has been selected, such as updating UI elements, initiating further interactions, or processing contact details. | contact |
This section contains functions that help manage the Navigation functions.
Function Name | Description | Parameter |
---|---|---|
lvcore.endScriptWithTermCode(lvResultId, agentAccountNumber, notReadyPrompt, paymentAmt) | This function is used to terminate a script session and write the associated data to the database. | lvResultId, agentAccountNumber, notReadyPrompt, and paymentAmt |
lvcore.previousPage() | This function navigates the user back to the previous page they were on in the script or application. This function is useful for allowing users to easily return to the last page they visited, facilitating smooth navigation and improving user experience. | - |
lvcore.goToPage(pageName) | This function navigates the user to a specified page within the script or application.
This function allows for seamless transitions between different pages in the interface, directing you to the desired page based on the provided pageName. | pageName |
This section contains functions that help manage the Update functions.
Function Name | Description | Parameter |
---|---|---|
lvcore.changeContact(contactNumber, successCallback, failureCallback, eventsOnRefresh) | This function changes the contact information associated with a script or application.
This function facilitates updating contact details while handling success and failure scenarios, and refreshes associated events or actions accordingly. | contactNumber, successCallback, failureCallback, eventsOnRefresh |
lvcore.updateScriptData(scriptDataName, value, mask) | This function updates or creates a Script Data variable within the script session.
This function allows you to update existing Script Data or create new Script Data variables within the session. If the mask parameter is used, it ensures that sensitive data is handled appropriately. The function also prints the updated value to the console for tracking purposes. | scriptDataName, value, mask |
lvcore.updateScriptDataAll() | This function updates all Script Data variables within the script session with their current values. This function ensures that any changes to Script Data variables are applied across the entire script session, maintaining consistency and reflecting the latest data for all relevant variables. | - |
lvcore.updateContact() | This function updates the contact information associated with the current script or application. | - |
lvcore.updateAccountNumberLegacy(contactNumber) | This function updates the account number associated with a contact using a legacy system in an inbound service.
This function updates the account information in systems that use older or legacy data formats, ensuring that the account number is accurately updated based on the provided contact number. The This function is intended to be used only in specific scenarios where backward compatibility with older systems is required. | contactNumber |
This section contains functions that help manage the utility functions.
Function Name | Description | Parameter |
---|---|---|
lvcore.getFormElementById(elementId) | This function retrieves a specific form element using its identifier.
This function lets you interact directly with a particular form element, enabling operations, such as reading its value, setting properties, or manipulating its state based on its ID. | elementId |
lvcore.lvalert(msg) | This function displays an alert message to the user.
This function is used to provide notifications or warnings through a pop-up alert | -msg |
lvcore.showItem(elementId) | This function makes a specified UI element visible on the page.
This function is useful for dynamically controlling the visibility of elements, allowing you to show certain UI components based on user actions or script conditions. | elementId |
lvcore.hideItem(elementId) | This function makes a specified UI element hidden on the page.
This function is useful for dynamically controlling the visibility of elements, allowing you to remove certain UI components based on user actions or script conditions. | elementId |
lvcore.mask(text) | This function is used to mask data or information. | text |
lvcore.unmask() | This function is used to unmask the data or information | - |