Skip to content

uploadContentNotes

uploadContentNotes(connection, inputs, linkedEntityIdsByExternalId, options?): AsyncGenerator<ContentNoteResult>

Defined in: contentNoteUtils.ts:129

Create a stream of ContentNotes, linking each one to a parent record resolved from linkedEntityIdsByExternalId.

inputs is consumed lazily and notes are created with bounded concurrency (see mapConcurrent from @simplysf/simply-core), so a large input (e.g. rows streamed from a CSV via csv-parse) never has to be fully buffered in memory. Results are yielded in completion order, not input order — write them straight to a report as they arrive (e.g. with createCsvFileWriter/writeRecordsToCsvFile from @simplysf/simply-core) rather than collecting them into an array first.

linkedEntityIdsByExternalId is a plain Map, built however the caller likes — a fresh query (e.g. queryRecords() from @simplysf/simply-core, reduced into a Map) or a previously cached one re-read from disk. An input whose linkedRecordExternalId has no entry in the map produces a stage: 'lookup' error result without attempting any DML.

Connection

The org connection to create records on.

AsyncIterable<ContentNoteInput, any, any> | Iterable<ContentNoteInput, any, any>

The notes to create.

ReadonlyMap<string, string>

Maps each linkedRecordExternalId to the Salesforce record ID it should be linked to.

UploadContentNotesOptions = {}

Concurrency configuration.

AsyncGenerator<ContentNoteResult>

Each note’s outcome, in completion order.