Task Reference
set_destination_id
Store the mapping between a source record and its created destination ID for idempotent reruns.
set_destination_id
Upserts a source-to-destination ID mapping into the mapping store and passes the input through unchanged.
When to use it
Use set_destination_id right after a create step in the manual dedup pattern, paired with get_destination_id. For new tasks, prefer sync_record, which persists the mapping as part of one composite step.
Configuration
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
connector |
string | Yes | — | Connector slot for the mapping store. |
resource |
string | Yes | — | Resource or entity name the mapping is scoped to. |
source_id |
string | Yes | — | Source system ID. Coerced to a string. |
destination_id |
string | Yes | — | Destination system ID. Coerced to a string. |
hash |
string | No | — | Content hash stored alongside the mapping for change detection. |
Example
name: migrate-accounts
output: none
connectors:
source:
type: csv
destination:
type: dynamics365
mapping_db:
type: sqlite
steps:
- name: read_accounts
type: call_method
config:
connector: source
method: read
args:
resource: accounts
- name: create_account
type: call_method
config: |
{
"connector": "destination",
"method": "create",
"args": { "resource": "accounts", "data": input }
}
- name: store_mapping
type: set_destination_id
config: |
{
"connector": "mapping_db",
"resource": "account",
"source_id": steps.read_accounts.output.account_id,
"destination_id": input.accountid
}Note that after create_account, input is the create response, so the source ID is read from the earlier step via steps.read_accounts.output.
Behavior notes
- Empty IDs are rejected loudly. A
destination_idthat is undefined, null, an empty string, or the literal strings"null"/"undefined"fails the step withset_destination_id: refusing to write empty destination_id .... An emptysource_idfails the same way. Gate the step withskip_ifwhen no real destination ID is available — for example when a preceding create witherror_handling: ignorefailed. - The input passes through unchanged — the step writes the mapping and emits its input as-is.
- The mapping is written through the connector's mapping store, the same store get_destination_id reads.
Related
- get_destination_id — the read half of the mapping pair
- sync_record — the preferred composite replacement
- Idempotent sync and the mapping DB — mapping-store patterns and rerun safety