$object
Updated on Aug 29, 2025 10 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. | 
| copy | Copies an existing object and opens a modal to create a new one based on it. | 
| 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. | 
Methods Details
batchDelete()
• Type
// Overload 1: single script alias
(
    scriptAlias: E8ScriptAlias,
    ids: E8ObjectId[],
    params?: ObjectParams,
) => Promise<void>;
// Overload 2: multiple script aliases
(
    batch: object,
    params?: ObjectParams,
) => Promise<void>;• Details
Expects a script alias, an array of record IDs, and optional ObjectParams (default: { silent: false }).
Overload 2: 
Expects a batch object containing multiple script aliases with their corresponding arrays of record IDs and optional ObjectParams (default: { silent: false }).
Returns a Promise that resolves with true if all objects are successfully deleted.
Throws an IntegrityViolationError if deletion violates integrity constraints.
• Example
// --- Overload 1: Delete multiple records for a single script alias ---
E8App.$object.batchDelete(
    'lstExample',                // Script alias of the object
    ['101', '102', '103'],       // Array of record IDs to delete
    { silent: false }            // Optional: run with events/hooks (default)
).then(() => {
    console.log('Records deleted successfully (lstExample).');
}).catch((error) => {
    if (error.name === 'IntegrityViolationError') {
        console.error('Cannot delete: integrity constraint violation.', error);
    } else {
        console.error('Batch delete failed:', error);
    }
});
// --- Overload 2: Delete records across multiple script aliases ---
E8App.$object.batchDelete(
    {
        lstExample: ['201', '202'],         // Delete from lstExample
        anotherExample: ['301', '302'],     // Delete from anotherExample
    },
    { silent: true } // Optional: delete silently without triggering hooks/notifications
).then(() => {
    console.log('Batch delete across multiple aliases completed successfully.');
}).catch((error) => {
    if (error.name === 'IntegrityViolationError') {
        console.error('Cannot delete: integrity constraint violation.', error);
    } else {
        console.error('Batch delete failed:', error);
    }
});batchSave()
• Type
// Overload 1: single script alias
(
    scriptAlias: E8ScriptAlias,
    objects: object[],
    params?: ObjectParams,
) => Promise<object>;
// Overload 2: multiple script aliases
(
    batch: object,
    params?: ObjectParams,
) => Promise<object>• Details
Expects a script alias, an array of record IDs, and optional ObjectParams (default: { silent: false }).
Overload 2: 
Expects a batch object containing multiple script aliases with their corresponding arrays of record IDs and optional ObjectParams (default: { silent: false }).
Returns a Promise that resolves with an array of saved objects.
• Example
// Example 1: Save multiple objects for a single script alias
E8App.$object.batchSave(
    'lstExample', // Script alias of the object
    [
        { id: '123', name: 'Updated Name 1' }, // Existing record (will be updated)
        { name: 'New Record' },                // New record (will be created)
    ],
    { silent: false } // Optional params
).then((saved) => {
    console.log(saved); // Array of saved objects
});
// Example 2: Save multiple objects across different script aliases (batch)
E8App.$object.batchSave(
    {
        lstExample: [
            { id: '456', name: 'Updated in lstExample' },
            { name: 'Another New Record' },
        ],
        lstAnotherExample: [
            { id: '789', title: 'Updated in anotherExample' },
        ],
    },
    { silent: true } // Save silently without triggering hooks/notifications
).then((saved) => {
    console.log(saved); // Object containing results grouped by script alias
});copy()
• Type
(
    scriptAlias: E8ScriptAlias,
    id: E8ObjectId,
    formSize: FormSizes,
    form?: E8ScriptAlias,
    params?: ObjectParams
) => void• Details
Expects a script alias of the object type,
the source record ID,
the form size FormSizes (default: the size defined in the form builder if not explicitly provided),
an optional form script alias (default: form defined by role and order in the application builder if not explicitly provided),
and optional ObjectParams (default: { silent: false }).
Opens a modal to create a new object based on the source.
create()
• Type
(
    scriptAlias: E8ScriptAlias,
    params?: ObjectParams
) => Promise<object>• Details
Expects a script alias and optional ObjectParams (default: { silent: false }).
Returns a Promise resolving with the created object.
delete()
• Type
(
    scriptAlias: E8ScriptAlias,
    id: E8ObjectId,
    params?: ObjectParams
) => Promise<void>• Details
Expects a script alias, record ID, and optional ObjectParams  (default: { silent: false }).
Returns a Promise resolving when the object is deleted.
Throws IntegrityViolationError if deletion violates integrity constraints.
findById()
• Type
(
    scriptAlias: E8ScriptAlias,
    id: E8ObjectId,
    params?: ObjectParams
) => Promise<object>• Details
Expects a script alias, record Id, and optional ObjectParams (default: { silent: false }).
Returns a Promise resolving with the retrieved object.
save()
• Type
(
    scriptAlias: E8ScriptAlias,
    object: object,
    params?: ObjectParams
) => Promise<object>• Details
Expects an object to save, its script alias, and optional ObjectParams (default: { silent: false }).
Returns a Promise resolving with the saved object.