Prevent duplicate CRM records when automations retry
Choose stable event keys, understand search-before-create races, and use a replay checklist to prevent duplicate CRM records without hiding failures.
Guide by the Otomatzia editorial team · source content checked on

Why duplicates happen
A retry should not create a second business action for the same event. Start with a stable event identifier, a destination that can enforce the chosen uniqueness rule, and a way to reconcile an uncertain result. A successful search alone does not provide that protection.
Triggers can arrive more than once, a person can resubmit a form, and a workflow can retry after the destination has already accepted a write. The automation may see a timeout even though the CRM contains the new record. Treating every run as a new request turns these ordinary delivery conditions into duplicates.
This guide is design guidance for a form-to-CRM workflow. The worksheet is a planning and acceptance-test artifact, not a claim that a particular CRM integration has been executed or that a provider guarantees exactly-once delivery.
Define the event, entity and business action
An event identifies one occurrence, such as a particular form submission. An entity identifies a person or company. A business action identifies the effect you intend to perform, such as recording an inquiry. These identities answer different questions and should not share one accidental deduplication rule.
The same person can submit two legitimate inquiries. Their email address may help locate a contact, but it does not prove that the second inquiry is a duplicate. Conversely, two deliveries of one source event can carry slightly different transport metadata while still requesting the same action. Define that boundary before choosing the key.
- Keep the source's stable event ID when one is available. Record the source and operation as part of its scope.
- Define normalization according to the destination's documented identity rules. Do not assume that a lowercased email is a universal unique business key.
- Give separate intended effects separate identities. Creating a record and sending a notification are not the same completed action.
Patterns
Search before create is useful for finding an existing entity. A stored source ID helps connect later deliveries to earlier work. A documented upsert can reduce a read-then-write gap, and a real unique constraint can enforce an operation-key rule at the destination. Choose a pattern for the particular record and write path, rather than assuming that the word deduplication covers the whole workflow.
HubSpot documents different matching behavior for different record types and creation paths. Its company-domain deduplication does not apply to companies created through the API. Check the path your automation actually uses; a manual or import workflow is not evidence that an API write has the same protection.
Why search before create can still race
Imagine two workers handling the same event at the same time. Worker A searches and finds nothing. Before A creates the record, worker B also searches and finds nothing. Both then create a record. Each individual step behaved as configured, but the combined process violated the intended rule.
Moving the search earlier, adding a delay or disabling one visible button does not prove that overlapping workers cannot write. The check and the decision to accept the unique operation need an appropriate destination guard. If that guard is unavailable, label the limitation and route uncertain cases to reconciliation instead of promising automatic duplicate prevention.
Choose a destination guard
For a database-backed operation, an enforced unique key and suitable conflict handling can make the accept-or-reuse decision atomic. PostgreSQL documents an atomic insert-or-update outcome for ON CONFLICT DO UPDATE, provided no independent error prevents the statement. This is a property of that database statement, not a guarantee about every later business effect.
An upsert that increments a value or triggers another action on every update can repeat an effect even when it never creates a second row. Choose safe conflict behavior for the intended operation. A durable in-progress claim also is not a completed result: another worker must wait within a defined policy or reconcile the state, not declare success just because the claim exists.
Reconcile an unknown outcome before replay
A timeout describes what the caller observed, not what the destination committed. First read back using your own stable reference, the recorded destination ID or a provider-supported status check. If a completed result is confirmed, reuse it rather than creating another operation.
If a retry is supported, retain the same provider key while its documented protection remains valid. Do not invent a new key as the first response to uncertainty. If the provider cannot establish the result, or the original key is no longer protected, keep the operation in an explicit unknown state for reconciliation or operator review.
Provider contracts differ by API version. Stripe API v1 saves the first executed response for a key, including server-error responses; its API v2 has different retry behavior. Replaying the same key is therefore not a universal instruction to keep retrying every error until a green response appears.
Separate a record write from its follow-up actions
Suppose the CRM write succeeds and a follow-up notification fails. Replaying the whole workflow as a new event can create another record or send another notification. Record which effect completed and reconcile each outstanding effect under its own identity.
A database transaction cannot by itself make an external email, payment or message atomic with a local row. Keep a recoverable record of the intended follow-up work and its known result. Where a downstream service offers no appropriate deduplication or readback contract, document the remaining duplicate risk and the manual recovery path.
Keep the key and payload consistent
A retry of one operation should carry the same stable key and the same intended content. If the key matches but the business payload changes, reject the conflict or require review instead of quietly returning a result for different instructions. Conversely, do not generate a fresh random key for every delivery of the same event.
Store enough durable state to distinguish in progress, completed, failed and unknown outcomes across restarts. Retention must cover the relevant replay behavior and the provider's own key lifecycle. Avoid personal or sensitive data in idempotency keys; use an appropriate opaque identifier and restrict the operational logs.
Limits
Search then create is not atomic. A spreadsheet lookup is not a uniqueness lock. A workflow platform's retry setting does not establish the CRM's identity rules, and a destination's duplicate-management tools remain a backstop to review rather than proof that every path is protected.
This guide does not promise an identical HTTP response on every replay. Idempotency concerns the intended effect. It also does not turn separate valid actions for one customer into duplicates. Keep those distinctions visible when reviewing a workflow or asking a specialist to implement it.
Use the replay test worksheet
Use the table and downloadable CSV below to define acceptance before connecting live data. The six cases cover a sequential duplicate, overlapping deliveries, changed content under one key, a missing key, an uncertain external write, and a replay after restart or delay. All identifiers in the worksheet are illustrative.
Fill in the destination evidence and responsible reviewer for your own process. Run cases in a safe test environment only after the intended behavior is agreed. The worksheet describes what to verify; downloading it or seeing a successful workflow run does not mean that your integration passed.
Decide whether the workflow is ready
Read the destination back after each test. Compare operation keys, destination record IDs and actual business effects, not only workflow execution counts. Verify that overlapping runs cannot both become a new accepted operation and that an unknown result remains visible until reconciled.
A useful handover includes the identity rule, known provider limits, the replay worksheet, an owner and a recovery procedure. If those cannot be demonstrated, keep the uncertain path under review. Use the related form-to-CRM recipe as an illustrative design, the HubSpot and Google Sheets profiles for tool context, and the webhook guide for delivery basics.
Scroll the table sideways to read every column.
| Scenario | Stable event key | Expected action | Evidence to collect |
|---|---|---|---|
| Sequential duplicate | event-demo-A | Reuse the confirmed completed result; no new business effect. | Original and repeated destination record IDs; effect count. |
| Concurrent deliveries | event-demo-A | Enforce one accepted operation; wait within policy or reconcile the other worker. An in-progress claim is not completion. | Unique-operation decision, worker states and final destination ID. |
| Same key, changed payload | event-demo-A | Reject the mismatch or require operator review; never silently reuse the result for different instructions. | Conflict outcome and minimal payload comparison, without unnecessary personal data. |
| Missing stable key | missing | Reject or require review; do not generate a new operation key for every retry. | Validation outcome and evidence that no new write was accepted. |
| Timeout after external write | event-demo-A | Read back by the stable reference first. Retry with the same provider key only while its contract retains protection; otherwise reconcile. | Destination status or recorded result; unresolved outcomes stay explicitly unknown. |
| Restart or delayed replay | event-demo-A | Recover durable state, check key retention and reconcile follow-up effects separately. | Persisted operation state and destination readback after restart. |
Sources to check next
- MDN: idempotent intended effects and differing responses
- PostgreSQL: INSERT and ON CONFLICT
- Stripe: version-specific idempotent request contracts
- HubSpot: record and creation-path deduplication rules
- Google Sheets API concepts
- Airtable Web API documentation
Vendor features and prices change. Confirm details on the linked official pages before you rely on them.
What to read next
- Recipe: form submissions to CRM without duplicate contacts
- Google Sheets: work management features and setup
- HubSpot: crm features and setup