sf-fx-runtime-nodejs / DataApi
Interface: DataApi
Data API client to interact with data in a Salesforce org.
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
▸ 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.
Name | Type | Description |
---|---|---|
unitOfWork | UnitOfWork | The UnitOfWork to commit. |
Returns: Promise<Map<string, RecordModificationResult>>
A map of RecordModificationResults, indexed by their ReferenceIds.
▸ create(record
: RecordForCreate): Promise<RecordModificationResult>
Creates a new record described by the given RecordForCreate.
Name | Type | Description |
---|---|---|
record | RecordForCreate | The record create description. |
Returns: Promise<RecordModificationResult>
A RecordModificationResult that contains the created data wrapped in a Promise.
▸ delete(type
: string, id
: string): Promise<RecordModificationResult>
Deletes a record, based on the given type and id.
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(): UnitOfWork
Creates a new and empty UnitOfWork.
Returns: UnitOfWork
An empty UnitOfWork.
▸ query(soql
: string): Promise<RecordQueryResult>
Queries for records with a given SOQL string.
Name | Type | Description |
---|---|---|
soql | string | The SOQL string. |
Returns: Promise<RecordQueryResult>
A RecordQueryResult that contains the queried data wrapped in a Promise.
▸ queryMore(recordQueryResult
: RecordQueryResult): Promise<RecordQueryResult>
Queries for more records, based on the given RecordQueryResult.
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
: RecordForUpdate): Promise<RecordModificationResult>
Updates an existing record described by the given RecordForUpdate.
Name | Type | Description |
---|---|---|
update | RecordForUpdate | The record update description. |
Returns: Promise<RecordModificationResult>
A RecordModificationResult that contains the updated data wrapped in a Promise.