Scripting Engine
Essembi's scripting engine is powered by JavaScript and is ECMAScript 6 (Strict). Within the areas that have scripting enabled, users can write JavaScript in a monaco-editor with auto-complete for the full ES6 standard library plus the Essembi library.
Where is the scripting engine available?
View Drill Downs
Drill downs can be configured for individual elements within chart views or from columns in sheet views. Examples of drill downs from chart views include drilling down from individual bar graph elements, line graph results, or metric cards. Examples from sheet views include drilling down from a record into a form, or from a high level summary into a lower level summary (for example, formula level OEE drilling down into work order level OEE results).
Form Buttons
A button with a custom click event can be added to any form. For example, the default work order form in Essembi contains buttons to simplify the operator inputs for starting, pausing, or finishing a work order. Typically these buttons are used to create or update existing records or sub-records, automatically navigate to other views or forms after an action is taken, or prompt the user to add more information via a custom prompt with an input field.
Calculated Field Types
Calculated fields can be added to any table within Essembi. They can utilize logic that references other fields in tables within the organization's app. Because they are a field, they can be shown in views and/or data entry forms. Calculated fields can be retrieved via API but cannot be set via API or any other method for security purposes.
Validations Script
Validation scripts enable Essembi users to throw a string to alert a user of a validation error when saving a record. It fires on the save of a form. Validation scripts also fire on data entered via alternative add methods such as API or entry via an Excel import to ensure data integrity.
JavaScript Library
The entirety of the JavaScript standard library has been exposed, excluding any aspects of the library that would interact with the Document Object Model (DOM), Window, or other client-specific functions and objects. This means you can use objects like Math and JSON but not window or document.
Essembi's Library
Record Object Schema
A record is any instance of any data that has been saved in a table in Essembi. A consistent set of methods and properties are available on all records.
Drill Downs and View Navigation
Drill down scripts allow you to navigate from one view to another with contextual filtering. These are commonly used in charts, metric cards, and sheets to provide deeper analysis when users click on data points.
Loading Views
The app object provides methods to load different view types (app.loadChartsView, app.loadSheetView, and equivalents for boards, gantts, and timelines). All methods support optional filtering to show relevant data.
Adding Filters to Views
After loading a view, you can add dynamic filters using the addFilter() method. This is useful for showing only relevant records based on user interaction. Common filter conditions include Equal, Not Equal, Greater Than / Less Than, Between (requires an endValue parameter), Contains, and Is Empty / Is Not Empty.
Adding Options to Views
The addOption() method configures view-specific settings like grouping dimensions or time ranges.
Customizing View Names
You can set a custom name for the loaded view to provide context to the user.
Opening Forms from Scripts
You can also navigate to forms to create or edit records directly from a script.
Building Dynamic Inquiry Prompts
You can prompt users for input using the form.createInquiry() method. This displays a dialog where users can enter information before the script continues executing. When the user submits the prompt, you receive an object with properties matching the fields you specified; if the user cancels, the call returns null.
Returning Messages
Button scripts can return a string that will be displayed to the user after execution.
Current User Properties
The user object provides access to information about the currently logged-in user. This is useful for personalizing scripts, filtering data based on user identity, or logging user actions.
Example Scripts
Common drill-down patterns include drilling from a sheet into a record's form, from a bar chart into a filtered view, from a metric card into a detail sheet, and from one chart view into another chart view with a narrower filter. See the in-app scripting editor for live examples tailored to your data model.