AI Help
How do I prevent an AI workflow retry from creating duplicate CRM records?
Use a stable event key and an atomic duplicate check before a CRM write. Reconcile uncertain writes before retrying them.
Steps to follow
- Derive a key from the original event ID and intended operation. Store processing state in a persistent system with a uniqueness constraint.
- Claim that key atomically, then write using the CRM's documented idempotency or unique external-ID feature when available. A search followed by create can race.
- Record the returned CRM ID and outcome. After a timeout, inspect the destination before repeating a write whose outcome is unknown.
Example in practice
Illustrative example. Two deliveries of lead event L-42 should resolve to one CRM contact and one stored completion record.