Agent Guidance Core User Guide

Please email support@creovai.com for omissions or errors.
×
Menu

Code Editor

 
The Code Editor window allows entering code that will be executed when the Workflow is run - although exactly when the code is executed does vary between different Control types. It provides a simple and lightweight coding interface, including "linting" to highlight potential issues in the code, contextual highlighting to improve readability, the ability to quickly select available Fields and Variables, and some options to customise the coding experience to your own preference.
 
While the Code Editor window is used to enter JavaScript, there are specific instances (such as within the Datasource Wizard) where a similar window called the Query Writer is used and SQL code is entered instead.
 
Code Editor
 
 
1

Code Window

1. Code Window
 
This is where code is actually entered. This allows usage of standard JavaScript, referencing Fields and Variables from Agent Guidance, Helper Functions, and any JavaScript enabled by the Third-Party Libraries.
 
The code has linting applied, which means that common coding mistakes (such as unrecognised Field or Variable names) or potentially broken code (such as unclosed strings) are flagged up with colour cues or as warnings in the margin of the code window. Hovering over any warnings in the margin will display a summary of what the encountered error or warning is.
 
2

Fields List

2. Fields List
 
Any Fields on the current Page can be easily referenced simply by clicking them in this list. Remember that if a Field isn't on the current Page, it can't be altered or read from JavaScript (except via specific Helper Functions)!
 
3

Variables List

3. Variables List
 
Similarly to Fields, any System and Workflow Variables can be selected by expanding this tray. Unlike Fields, Variables are available on every Page - but their values are removed from the database after the record is completed. Workflow Variables can also be created by clicking the Edit Variables button on the right-hand side of the tray header.
 
4

Editor Options

4. Editor Options
 
This tray contains three options that can be toggled based on User preference.
  • Text Wrapping: if enabled, when text reaches the boundary of the code window, it will be wrapped to the line below. Otherwise, the text remains on its current line, and horizontal scrolling is enabled.
  • Smart Indent: if enabled, code indentation will be applied automatically where appropriate as new lines are generated. This can be used to help produce a more readable and neat code structure.
  • Code Assistance: if enabled, then as you type specific characters (quotes, opening brackets, etc.) the closing character will automatically be added too. This can be used to speed up typing code, and reduce the chance of closing a structure improperly.