---
schema_version: "1"
id: 74ea72b4864b0ac1fc869990c7ecb34b57f50e348b8ea18a8f50fb502012c795
title: "Interface: UnitOfWork"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-functions/functions/guide/nodesdk/interfaces/unitofwork.md
canonical_url: https://developer.salesforce.com/docs/platform/functions/guide/unitofwork.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 35cb9a0ff27ee20e3e90d2e0c85de27678ab03ed42a3e080ce7eab60687b3ef9
products:
  - Salesforce Functions
---
[sf-fx-runtime-nodejs](https://developer.salesforce.com/docs/platform/functions/NODE_README.md) / UnitOfWork

# Interface: UnitOfWork

Represents a UnitOfWork.

## Methods

### registerCreate

▸ **registerCreate**(`record`: [_RecordForCreate_](https://developer.salesforce.com/docs/platform/functions/modules.md#recordforcreate)): _string_

Registers a [RecordForCreate](https://developer.salesforce.com/docs/platform/functions/modules.md#recordforcreate) for the [UnitOfWork](https://developer.salesforce.com/docs/platform/functions/guide/unitofwork.md) and returns a [ReferenceId](https://developer.salesforce.com/docs/platform/functions/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_](https://developer.salesforce.com/docs/platform/functions/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_](https://developer.salesforce.com/docs/platform/functions/modules.md#recordforupdate)): _string_

Registers a [RecordForUpdate](https://developer.salesforce.com/docs/platform/functions/modules.md#recordforupdate) for the [UnitOfWork](https://developer.salesforce.com/docs/platform/functions/guide/unitofwork.md) and returns a [ReferenceId](https://developer.salesforce.com/docs/platform/functions/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_](https://developer.salesforce.com/docs/platform/functions/modules.md#recordforupdate) | The record to update. |

**Returns:** _string_

The ReferenceId for the updated record.

