The Code Editor window allows the Workflow Designer to enter code that will be executed during the Workflow run - although exactly when the code is executed does vary between different Controls. It provides a simple and lightweight coding interface, including Lint 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 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 T-SQL code is entered instead.
Code Window
This is where code is actually entered. This allows usage of standard JavaScript, Scripting's Fields and Variables references, Helper Functions, and any JavaScript enabled by the Third-Party Libraries.
The code has Lint applied, which means that common coding mistakes (such as unrecognised Field names) or potentially broken code (such as unclosed strings) are flagged up with colour cues or 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.
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!
Similarly to Page Fields, any System or Workflow Variables can be selected by expanding this tray. Unlike Fields, Variables are available on every page - but their values aren't saved back to the database after the Workflow run is completed. Workflow Variables can also be created by clicking the button on the right-hand side of the tray header.
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 part of having a more readable and neat code structure.
Code Assistance: if enabled, then Helper Functions will be suggested as you start to type them. This can reduce the need to memorise function names, and reduce typing by allowing you to select the appropriate option.