sf-fx-runtime-nodejs / DataApi
Data API client to interact with data in a Salesforce org.
Properties
accessToken
The access token used by this API client. Can be used to initialize a third-party API client or to perform custom API calls with a HTTP library.
• Readonly accessToken: string
Methods
commitUnitOfWork
▸ commitUnitOfWork(unitOfWork: UnitOfWork): Promise<Map<string, RecordModificationResult>>
Commits a UnitOfWork, executing all operations registered with it. If any of these operations fail, the whole unit is rolled back. To examine results for a single operation, inspect the returned map (which is keyed with ReferenceId returned from UnitOfWork.registerCreate and UnitOfWork.registerUpdate.
Parameters
| Name | Type | Description |
|---|---|---|
unitOfWork |
UnitOfWork | The UnitOfWork to commit. |
Returns: Promise<Map<string, RecordModificationResult>>
A map of RecordModificationResults, indexed by their ReferenceIds.
create
▸ create(record: RecordForCreate): Promise<RecordModificationResult>
Creates a new record described by the given RecordForCreate.
Parameters
| Name | Type | Description |
|---|---|---|
record |
RecordForCreate | The record create description. |
Returns: Promise<RecordModificationResult>
A RecordModificationResult that contains the created data wrapped in a Promise.
delete
▸ delete(type: string, id: string): Promise<RecordModificationResult>
Deletes a record, based on 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: Promise<RecordModificationResult>
A RecordModificationResult that contains the deleted data wrapped in a Promise.
newUnitOfWork
▸ newUnitOfWork(): UnitOfWork
Creates a new and empty UnitOfWork.
Returns: UnitOfWork
An empty UnitOfWork.
query
▸ query(soql: string): Promise<RecordQueryResult>
Queries for records with a given SOQL string.
Parameters
| Name | Type | Description |
|---|---|---|
soql |
string | The SOQL string. |
Returns: Promise<RecordQueryResult>
A RecordQueryResult that contains the queried data wrapped in a Promise.
queryMore
▸ queryMore(recordQueryResult: RecordQueryResult): Promise<RecordQueryResult>
Queries for more records, based on the given RecordQueryResult.
Parameters
| Name | Type | Description |
|---|---|---|
recordQueryResult |
RecordQueryResult | The query result to query more data for. |
Returns: Promise<RecordQueryResult>
A RecordQueryResult that contains the queried data wrapped in a Promise.
update
▸ update(update: RecordForUpdate): Promise<RecordModificationResult>
Updates an existing record described by the given RecordForUpdate.
Parameters
| Name | Type | Description |
|---|---|---|
update |
RecordForUpdate | The record update description. |
Returns: Promise<RecordModificationResult>
A RecordModificationResult that contains the updated data wrapped in a Promise.