Skip to main content

In-platform Development

Introduction

When developing within Simplicité — writing CLASS resources for External Objects, custom dispositions, or any JavaScript executed inside the platform — you have direct access to the Simplicité runtime through a set of global objects.

This page covers the in-platform JavaScript context. For standalone applications connecting to Simplicité from outside, see NPM Library.

Global objects

The following objects are available in any JavaScript resource executed within the platform:

ObjectTypeDescription
$uiSimplicite.UI.EngineMain UI controller — entry point for most operations
$appSimplicite.ApplicationAjax service / data model
$viewSimplicite.UI.ViewView engine
$grantSimplicite.Ajax.GrantCurrent user rights and information
$navSimplicite.UI.NavigatorNavigation controller
$toolsSimplicite.UI.ViewBootstrap utility methods
$TFunctionTranslation shorthand

Most objects are also accessible through $ui:

$ui.app    // same as $app
$ui.view // same as $view
$ui.grant // same as $grant
$ui.nav // same as $nav

For the full API reference, see Ajax Library.

Writing a CLASS resource

The CLASS resource is the JavaScript entry point of an External Object. It defines a class extending Simplicite.UI.ExternalObject with an async render() method:

Simplicite.UI.ExternalObjects.MyComponent = class extends Simplicite.UI.ExternalObject {
async render(params, data = {}) {
const $content = this.ctn; // root container of the component
$content.html('<p>Hello World</p>');
}
};

Access the root container via this.ctn. Use standard DOM manipulation or jQuery to build your UI from there.

Working with Business Objects

Accessing an object

const product = $app.getBusinessObject('DemoProduct');

Searching

product.search({ demoPrdSupId__demoSupCode: 'BIM' }).then(rows => {
for (const row of rows) {
console.log(row.demoPrdName, row.demoPrdUnitPrice);
}
});

Field naming conventions

PatternExampleDescription
objPrefixFieldNamedemoPrdNameStandard field on the object
foreignKeyId__linkedFieldNamedemoPrdSupId__demoSupNameJoined field from a linked object

Check Business Objects > [Your Object] > Object Fields in the back-office for the exact field names available on any given object.

Displaying native UI elements

// Display a record's form in the WORK area
$ui.displayForm(null, 'DemoProduct', rowId, {
nav: 'add',
target: 'work'
});

// Display a list
$ui.displayList(null, 'DemoProduct', null, {
target: 'work'
});

Access control

External Objects are visible only to users who have been granted the appropriate rights. For objects intended to be accessible without a user session, specific access configuration is required.

Refer to External Objects — Access & Rights.