Awaken Scripting User Guide

Please email for omissions or errors.


The Calculate control allows users to add JavaScript code to a Workflow Page that is executed when the Page initially loads, and also whenever the value of any Field on the Page is altered.
This can be contrasted with the JavaScript, where the code is only executed a single time upon Page load, but retains its state after that.
The Calculate 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 Calculate 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 Calculate'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 builder the purpose of the Calculate at a glance.
To configure the code to be executed, use the Code Editor in the Advanced Options tab.


Refer to the Code Execution article for specific details as to JavaScript execution order and variable scope.
Due to the code within a Calculate control being executed every time a value is updated on the page (except for when this update is updated by the Calculate itself), particular care should be taken of how code is written in the Calculate. Use of conditional statements (if (...) {...} else {...}) can be used to control what code is executed and when.
If you need to limit how many times the Calculate field runs please see the "Run Once" article in the Knowledge Base.
Helper functions can also be used in the Calculate 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.