Use the Lowgile Console
This tutorial describes how to use the Lowgile console during development to build and execute custom code, test expressions, inspect runtime data, and troubleshoot application behavior.
Prerequisites
Section titled “Prerequisites”Before beginning this tutorial, you should:
- Have access to the Lowgile platform development environment, and
- Be familiar with basic TypeScript or JavaScript syntax.
Tip
For a quick reference, see TypeScript Patterns in Lowgile.
Getting started
Section titled “Getting started”The following sections describe common development workflows.
1. Open the console
Section titled “1. Open the console”The Lowgile console is available from the main Lowgile platform editor. It is not available from a running application or from individual object type editors.
Open the console by clicking the console icon in the top-right nav bar, or press F8.
2. Select the module context
Section titled “2. Select the module context”Before executing application-specific code, select the correct application module context (e.g., Orders or Purchasing).
After setting the module context, use This as an alias for the selected module.
For example, when the Orders module is selected:
const materials = This.Materials.getEntryList()instead of using:
const materials = Orders.Materials.getEntryList()Tip
For more information about using This as a module alias, see Using This in Lowgile.
Wildcard option
Section titled “Wildcard option”The module context selector also includes a wildcard option: *.
When this option is selected, reference application objects using their full module name instead of This.
For example, the following code will not execute when the wildcard option is selected:
const materials = This.Materials.getEntryList()Use the full module name instead:
const materials = Orders.Materials.getEntryList()Tip
Using the wildcard module context allows you to execute code for different application modules without updating the module context.
3. Console controls
Section titled “3. Console controls”As well as the module selector, the console nav bar also includes the following controls:
- Execute: Executes the current script or code block.
- Execute selection: Only executes the highlighted section of code.
- Clear output: Clears the console output window.
For example, to execute the following code block in full, click Execute:
const materials = This.Materials.getEntryList().map(e => ({ ...e, id: undefined }))return materialsTo execute only part of a script, select the required code and click Execute selection.
For example, in the following code snippet, select the final line (return This.Materials.getEntryList()) and click Execute selection:
const materials = This.Materials.getEntryList().map(e => ({ ...e, id: undefined }))return materials
return This.Materials.getEntryList()Attention
The following points bear relevance to the console controls:
- Clicking Execute runs the script from beginning to end, or until it reaches the first return statement. Any code after the first return will not execute.
- If no code is highlighted, clicking Execute selection does not execute the script and the console returns null.
Common console workflows
Section titled “Common console workflows”The following examples demonstrate common development and debugging tasks performed in the Lowgile console.
1. Develop and test custom code
Section titled “1. Develop and test custom code”Use the console to prototype custom logic before adding it to workflows, services, scripts, or AI-assisted extraction workflows.
For example, the following code calcluates VAT and returns both the intermediate and final values:
const subtotal = 1250const vat = subtotal * 0.15
return { subtotal, vat, total: subtotal + vat}The returned object allows you to verify that the calculation produces the expected values before reusing the logic elsewhere in the application.
Tip
For more information about building AI-powered applications, see Working with AI in Lowgile.
2. Execute simple expressions
Section titled “2. Execute simple expressions”The console can be used to execute simple runtime expressions.
For example:
return 1 + 13. Test a static entity
Section titled “3. Test a static entity”Static entities can be inspected directly in the console.
For example:
return Orders.Materials.getEntryList()This returns all entries currently loaded by the Materials static entity.
4. Transform returned data
Section titled “4. Transform returned data”Use TypeScript expressions to transform returned data before it is displayed in the console.
For example, in the following code snippet:
- The
map()function creates a new object for each entry. - The spread operator copies the existing properties, while
id: undefinedremoves theidvalue from the returned output.
const materials = Orders.Materials.getEntryList().map(e => ({ ...e, id: undefined }))return materialsThe console then displays the transformed data:
JSON[ { "name": "UP GM 203", "alternativeNames": "GPO-3, HM2471" }, { "name": "PF CP 201", "alternativeNames": "HP2061" }]5. Test dynamic static entity loading
Section titled “5. Test dynamic static entity loading”Use the console to verify that static entity entries have been loaded correctly from an external source, such as a spreadsheet.
For example, to retrieve the entries loaded into the Materials static entity, execute:
return This.Materials.getEntryList()If the spreadsheet was loaded successfully, the console returns the static entity entries:
For example:
JSON[ { "id": 1, "name": "UP GM 203", "alternativeNames": "GPO-3, HM2471" }, { "id": 2, "name": "PF CP 201", "alternativeNames": "HP2061" }, { "id": 3, "name": "PF CC 201", "alternativeNames": "HGW2082" }]If the configuration is incorrect or the data has not loaded successfully, the console may return an empty list, incomplete values, or a runtime error.