Awaken Scripting User Guide

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

JavaScript

 
The JavaScript control allows users to add JavaScript code that is executed a single time upon Page load, and retains its state afterwards.
 
This can be contrasted with the Calculate, which is executed upon Page load and then whenever any subsequent action is taken.
 
The JavaScript control isn't visible to the agent at all.
 
This control is part of the Intermediate control pack, and will only be available if you have the appropriate licence part.
 
 

How To

Add a JavaScript control to the Workflow Page. The Code Description can be set in the Options tab, and can be used to set a brief description of the JavaScript's function. Note that this is not visible to the agent, as neither is the control itself, but merely serves to clarify to a Workflow editor the purpose of the JavaScript 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 initialised, and so cannot be used to manipulate Workflow elements. As such, it is most commonly used to define functions or JavaScript variables, to be used throughout the Page. It is well suited to this purpose, as (within that Page) the values it holds are retained and accessible to all controls using JavaScript.
 
Helper functions can also be used in the JavaScript control.
 
It is also possible to define variables or functions globally across an entire installation of Scripting by placing it within custom.js. 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 Scripting JavaScript and General JavaScript Knowledgebase Articles.