Skip to content

EntityMethods

Entity methods interface - defines operations that can be performed on an entity

Methods

deleteRecords()

deleteRecords(recordIds: string[], options?: EntityDeleteOptions): Promise<EntityOperationResponse>

Delete data from this entity

Parameters

Parameter Type Description
recordIds string[] Array of record UUIDs to delete
options? EntityDeleteOptions Delete options

Returns

Promise<EntityOperationResponse>

Promise resolving to delete response


downloadAttachment()

downloadAttachment(recordId: string, fieldName: string): Promise<Blob>

Downloads an attachment stored in a File-type field of an entity record

Parameters

Parameter Type Description
recordId string UUID of the record containing the attachment
fieldName string Name of the File-type field containing the attachment

Returns

Promise<Blob>

Promise resolving to Blob containing the file content


getAllRecords()

getAllRecords<T>(options?: T): Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>

Get all records from this entity

Type Parameters

Type Parameter Default type
T extends EntityGetRecordsByIdOptions EntityGetRecordsByIdOptions

Parameters

Parameter Type Description
options? T Query options

Returns

Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<EntityRecord> : NonPaginatedResponse<EntityRecord>>

Promise resolving to query response


getRecord()

getRecord(recordId: string, options?: EntityGetRecordByIdOptions): Promise<EntityRecord>

Gets a single record from this entity by record ID

Parameters

Parameter Type Description
recordId string UUID of the record
options? EntityGetRecordByIdOptions Query options including expansionLevel

Returns

Promise<EntityRecord>

Promise resolving to the entity record


insertRecord()

insertRecord(data: Record<string, any>, options?: EntityInsertOptions): Promise<EntityRecord>

Insert a single record into this entity

Note: Data Fabric supports trigger events only on individual inserts, not on inserting multiple records. Use this method if you need trigger events to fire for the inserted record.

Parameters

Parameter Type Description
data Record<string, any> Record to insert
options? EntityInsertOptions Insert options

Returns

Promise<EntityRecord>

Promise resolving to the inserted record with generated record ID


insertRecords()

insertRecords(data: Record<string, any>[], options?: EntityOperationOptions): Promise<EntityOperationResponse>

Insert multiple records into this entity using insertRecords

Note: Inserting multiple records do not trigger Data Fabric trigger events. Use insertRecord if you need trigger events to fire for each inserted record.

Parameters

Parameter Type Description
data Record<string, any>[] Array of records to insert
options? EntityOperationOptions Insert options

Returns

Promise<EntityOperationResponse>

Promise resolving to batch insert response


updateRecords()

updateRecords(data: EntityRecord[], options?: EntityOperationOptions): Promise<EntityOperationResponse>

Update data in this entity

Parameters

Parameter Type Description
data EntityRecord[] Array of records to update. Each record MUST contain the record Id, otherwise the update will fail.
options? EntityOperationOptions Update options

Returns

Promise<EntityOperationResponse>

Promise resolving to update response


uploadAttachment()

uploadAttachment(recordId: string, fieldName: string, file: Blob | Uint8Array<ArrayBufferLike> | File, expansionLevel?: number): Promise<EntityUploadAttachmentResponse>

Uploads an attachment to a File-type field of an entity record

Parameters

Parameter Type Description
recordId string UUID of the record to upload the attachment to
fieldName string Name of the File-type field
file Blob | Uint8Array<ArrayBufferLike> | File File to upload (Blob, File, or Uint8Array)
expansionLevel? number Optional expansion level (default: 0)

Returns

Promise<EntityUploadAttachmentResponse>

Promise resolving to the upload response