upsert_record_by_key
Creates or updates a Dynamics 365 record by active alternate key, validating key metadata and types to prevent silent key changes. Races return errors; no automatic write retry.
Instructions
Use one active native alternate key with conditional PATCH. Validates key metadata/types and never silently changes key values. Races return errors; writes are never automatically repeated.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | Native JSON attribute data. Related bindings must stay inside the configured organization API. Local JSON limit 10 MiB. | |
| mode | No | Default upsert. Uses native conditional PATCH: create-only if absent, guarded update if present. No automatic retry on races. | |
| dryRun | No | Compatibility alias for dry_run. Conflicting aliases are rejected. | |
| dry_run | No | Read-only preview of environment, target, changes and write blockers. Default false; sensitive fields are masked. | |
| ifMatch | No | Compatibility alias for if_match. Conflicting aliases are rejected. | |
| if_match | No | Specific ETag from a prior read/preview. Without it, reads the current record ETag when the table supports concurrency. | |
| alternateKey | No | Compatibility alias for alternate_key. Conflicting aliases are rejected. | |
| alternate_key | No | Exact values for one declared active alternate key. Native metadata determines string/integer/choice/decimal/UTC datetime/lookup encoding. No null values. | |
| collectionName | No | Compatibility alias for collection_name. Conflicting aliases are rejected. | |
| collection_name | No | Native EntitySetName, such as accounts. Validated against table metadata. | |
| allowUnprotectedWrite | No | Compatibility alias for allow_unprotected_write. Conflicting aliases are rejected. | |
| allow_unprotected_write | No | Default false. Explicitly allow an unprotected write if table concurrency is unconfirmed, or for collection relationship membership. Does not bypass a supplied ETag conflict. |