Intelligent Agent Core User Guide

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

JavaScript

 
The JavaScript Control allows designers to add JavaScript code that is executed when the Page is initially loaded, and retains its state afterwards.
 
This can be contrasted with the Calculate, which is executed when the Page loads and then also whenever any subsequent action is taken.
 
The Field isn't visible to the agent at all.
 
This Control is part of the Intermediate Control pack, and will only be available if your System has the appropriate licence.
 
 

How To

Add a JavaScript Field to the Page. The Code Description can be configured in the Options tab of the Field Properties, and can be used to set a brief description of the functionality of the JavaScript Field. Note that this is not visible to the agent, as neither is the Field itself, but merely serves to clarify to a another User within the Designer the purpose of the JavaScript Field at a glance.
 
To configure the code to be executed, use the Code Editor in the Advanced Options tab.
 
 

Notes

Refer to the Code Execution article for specific details as to JavaScript execution order and variable scope.
 
The contained code is executed prior to Fields or System and Workflow Variables being fully initialised, and so cannot be used to read or manipulate the values of these Fields or Variables. As such, it is most commonly used to define functions (which may be used to manipulate Fields or Variables) or JavaScript variables that will then be used throughout the Page. It is well suited to this purpose, as the values it holds are retained and accessible to all Fields using JavaScript until the agent navigates to a different Page.
 
Helper Functions can also be used in the JavaScript.
 
It is also possible to define variables or functions globally across an entire installation of Intelligent Agent by placing it within the custom.js file. This is an advanced action with potentially dangerous outcomes if implemented improperly, please see this Knowledge Base article for further information.
 
Further examples of JavaScript use can be found in the Intelligent Agent JavaScript and General JavaScript Knowledgebase Articles.