$object
Updated on Aug 29, 2025 6 minutes to readThe Object Plugin provides methods to create, read, update, delete, copy, and batch process objects based on metadata definitions.
Methods
| Method | Description | 
|---|---|
| batchDelete | Deletes multiple objects at once, either by array of IDs or by object batch. | 
| batchSave | Saves multiple objects at once, either by array or by object batch. | 
| create | Creates a new object instance. | 
| delete | Deletes a single object by its ID. | 
| findById | Retrieves an object by its ID. | 
| save | Saves changes to a single object. | 
| updateAttributes | Updates rows using provided attribute values and optional conditions. | 
| updateCounters | Updates rows using provided counter changes and optional conditions. | 
Methods Details
batchDelete()
• Type
// Overload 1: single script alias
(scriptAlias: E8ScriptAlias, ids: E8ObjectId[]) => void;
// Overload 2: multiple script aliases
(batch: object) => void;• Details
Overload 1:
Expects a script alias and an array of record IDs.
Overload 2:
Expects a batch object containing multiple script aliases with their corresponding arrays of record IDs.
Deletes multiple objects.
Throws an IntegrityViolationError if deletion violates integrity constraints.
• Example
// --- Overload 1: Delete multiple records for a single script alias ---
E8App.$object.batchDelete('lstExample', ['101', '102', '103']);
// --- Overload 2: Delete records across multiple script aliases ---
E8App.$object.batchDelete({
    lstExample: ['201', '202'],
    lstAnotherExample: ['301', '302']
});batchSave()
• Type
// Overload 1: single script alias
(scriptAlias: E8ScriptAlias, objects: object[]) => object;
// Overload 2: multiple script aliases
(batch: object) => object;• Details
Overload 1:
Expects a script alias and an array of objects to save.
Overload 2:
Expects a batch object containing multiple script aliases with their corresponding arrays of record IDs.
Returns an array of saved objects.
• Example
// Example 1: Save multiple objects for a single script alias
const saved = E8App.$object.batchSave('lstExample', [
    { id: '123', name: 'Updated Name' },
    { name: 'New Record' }
]);
// Example 2: Save multiple objects across different script aliases (batch)
const savedBatch = E8App.$object.batchSave({
    lstExample: [{ id: '456', name: 'Updated' }, { name: 'Another' }],
    lstAnotherExample: [{ id: '789', title: 'Updated Title' }]
});create()
• Type
(scriptAlias: E8ScriptAlias) => object• Details
Expects a script alias of the object type.
Returns the newly created object.
delete()
• Type
(scriptAlias: E8ScriptAlias, id: E8ObjectId) => void• Details
Expects a script alias and a record ID.
Deletes the specified object.
Throws IntegrityViolationError if deletion violates integrity constraints.
findById()
• Type
(scriptAlias: E8ScriptAlias, id: E8ObjectId) => object | false• Details
Expects a script alias and a record ID.
Returns the object if found, otherwise false.
save()
• Type
(scriptAlias: E8ScriptAlias, object: object) => object• Details
Expects a script alias and an object to save.
Returns the saved object.
updateAttributes()
• Type
(
    scriptAlias: E8ScriptAlias,
    object: object,
    conditions?: Conditions
) => number• Details
Expects a script alias, an object containing attribute values to update, and optional Conditions to filter which rows to update.
⚠️ If you do not specify any condition, this method will update all rows in the table.
Returns the number of rows updated.
• Example
const updatedCount = E8App.$object.updateAttributes('lstExample', { status: 'Active' }, { id: '123' });
// updatedCount contains number of rows updatedupdateCounters()
• Type
(
    scriptAlias: E8ScriptAlias,
    object: object,
    conditions?: Conditions
) => number• Details
Expects a script alias, an object containing counter changes to apply, and optional Conditions to filter which rows to update.
⚠️ If you do not specify any condition, this method will update all rows in the table.
Returns the number of rows updated.
• Example
const updatedCount = E8App.$object.updateCounters('lstExample', { visits: 1 }, { status: 'Active' });
// updatedCount contains number of rows updated