Part of the Pravadh suite — IQ · SI · PM · GX · MW

Avoiding duplicate records

Re-running a flow shouldn't create the same record twice. That's what a dedup key is for, and it's backed by a small general-purpose primitive worth understanding on its own: the state store.

The state store

Underneath, Pravadh MW has a plain key-value store -- a namespace, a key, a value -- that survives between separate runs of the same flow. It's the same idea as Zapier Tables or MuleSoft's Object Store. Dedup is its first real use, but anything else a flow needs to remember between runs (a running count, an arbitrary lookup) would reuse the same primitive without a schema change.

Setting a dedup key

Set dedup_key to whatever field on the source uniquely identifies a record -- an email address, an external ID, a record ID. On the flow form, that's the Dedup field box next to the cursor field.

Once set, the engine checks the state store before writing each record: if that key's value was already written successfully on a prior run, the record is skipped. Only records that pass the filter are checked, and a key is only marked "seen" after a successful write -- a failed run doesn't falsely mark anything as done.

Why this matters more than it sounds

Some connectors don't protect you here on their own. Postgres already has on conflict do nothing if you want it, but Salesforce's connector does a bare create() -- with no dedup key, re-running a flow against Salesforce after a partial failure will happily create duplicate records. Setting a dedup key on any flow you might re-run isn't a nice-to-have, it's the difference between a safe retry and a mess to clean up by hand.

What's next