[sf-fx-runtime-nodejs](/docs/platform/functions/guide/NODE_README.md) / UnitOfWork

# Interface: UnitOfWork

Represents a UnitOfWork.

## Methods

### registerCreate

▸ **registerCreate**(`record`: [*RecordForCreate*](/docs/platform/functions/guide/modules.md#recordforcreate)): *string*

Registers a [RecordForCreate](/docs/platform/functions/guide/modules.md#recordforcreate) for the [UnitOfWork](/docs/platform/functions/guide/unitofwork.md) and returns a [ReferenceId](/docs/platform/functions/guide/modules.md#referenceid) that
can be used to refer to the created record in subsequent operations in this UnitOfWork.

#### Parameters

| Name     | Type                                                                           | Description           |
| :------- | :----------------------------------------------------------------------------- | :-------------------- |
| `record` | [*RecordForCreate*](/docs/platform/functions/guide/modules.md#recordforcreate) | The record to create. |

**Returns:** *string*

The ReferenceId for the created record.

***

### registerDelete

▸ **registerDelete**(`type`: *string*, `id`: *string*): *string*

Registers a deletion of an existing record of the given type and id.

#### Parameters

| Name   | Type     | Description                              |
| :----- | :------- | :--------------------------------------- |
| `type` | *string* | The object type of the record to delete. |
| `id`   | *string* | The id of the record to delete.          |

**Returns:** *string*

The ReferenceId for the deleted record.

***

### registerUpdate

▸ **registerUpdate**(`record`: [*RecordForUpdate*](/docs/platform/functions/guide/modules.md#recordforupdate)): *string*

Registers a [RecordForUpdate](/docs/platform/functions/guide/modules.md#recordforupdate) for the [UnitOfWork](/docs/platform/functions/guide/unitofwork.md) and returns a [ReferenceId](/docs/platform/functions/guide/modules.md#referenceid) that can
be used to refer to the updated record in subsequent operations in this UnitOfWork.

#### Parameters

| Name     | Type                                                                           | Description           |
| :------- | :----------------------------------------------------------------------------- | :-------------------- |
| `record` | [*RecordForUpdate*](/docs/platform/functions/guide/modules.md#recordforupdate) | The record to update. |

**Returns:** *string*

The ReferenceId for the updated record.
