Skip to content

Record rules

Record rules decide what each record does to the entry it matches. Create only, update only, or both; update only some fields; keep editors' changes; filter rows; publish now, as drafts, or at a date.

Each record carries a key, the column or value you chose as the import key in the wizard. The importer remembers which entry each key wrote to, so a later run of the same feed updates that entry instead of creating a new one. The rules below change what happens next. You set them in the wizard’s Options step, and a saved template keeps them, so scheduled runs follow them too.

Records sets what a record may do:

Option Template value A record whose entry exists A record with no entry
Create and update (default) "upsert" updates it creates one
Create only "create" is skipped creates one
Update only "update" updates it is skipped

A skipped record counts as unchanged, with a warning in the import’s log: “Skipped: the entry exists, and this import only creates entries.” or “Skipped: no entry has this key, and this import only updates entries.” A dry run reports the same.

Use Update only for a feed that should change entries but never add any, such as a price list for products you already have.

Update only these fields limits what an update writes. Tick the fields the feed owns, and every other field of an existing entry stays as it is. Tick none to update every mapped field. You can tick at most 200.

A new entry still gets every mapped field. The list can name a field, the slug, a taxonomy or the bylines. It doesn’t apply with Create only, which never updates.

Never overwrite fields edited in the admin protects editors’ work. When someone changed a field in the admin after the last import wrote it, the import leaves that field alone and writes the others. The record’s log says: “Not updated: the value was changed outside the import since it last wrote it.”

The protection covers every mapped field, the slug, taxonomies, references and bylines. It lifts on its own when the feed’s value and the entry’s value are the same again, or when a run without this option writes the field. It doesn’t apply with Create only.

Whatever the options, an import never writes over:

  • someone else’s pending draft or schedule. The record is a conflict until the draft is published or discarded, or the schedule is removed. The importer’s own drafts and schedules don’t count.
  • a locked entry. Someone has it open in the editor. The record counts as locked.

Use Retry failed records on the import’s row in Jobs to try conflicts and locked records again later.

Row filter, in the Source step under How to read it, imports only the records it is true for. It is a JSONata expression over the record’s keys. CSV values are text, so convert numbers first:

$number(Price) > 4 and Status = "active"

Records the filter leaves out count as filtered. The filter is part of what the feed selects, so for the missing-entries step a filtered record is not in the feed: an entry it created earlier can be moved to the trash or unpublished.

Status decides whether entries go live:

  • Publish: the import publishes what it writes.
  • Draft: the import saves what it writes as drafts. It never unpublishes or unschedules an entry. A schedule an earlier import set stays, and EmDash publishes the latest draft at that time.
  • Schedule: each entry is published at a Publish date. Choose The same date for every record (a date and time in the site’s timezone), or A date from the feed (a Source key, an optional Date format such as yyyy-MM-dd HH:mm, and a Timezone, UTC when left empty).

A publish date that is empty, already past, or less than a minute away publishes the entry at once.

On a collection without revisions, an update to a published entry goes live at once, so it can’t be scheduled. The record says so (“Not scheduled: the update goes live at once…”) and is written anyway. A schedule an editor set is never replaced.

A scheduled status needs publishing turned on. A schedule set to Save them as drafts can’t run a template that sets a publish date: its runs fail and the schedule pauses.

Owner, under Advanced, names the entries this template creates, and Missing from the feed decides what happens to them when a later feed no longer lists them. See Missing entries.

In a template file, the rules sit under rules, the publish date at the top level as publishAt, and the row filter under source:

{
"version": 1,
"source": { "format": "csv", "filter": "$number(Price) > 0" },
"collection": "products",
"locale": "en",
"key": { "from": "SKU" },
"fields": {
"title": { "from": "Name", "type": "text" },
"price": { "from": "Price", "type": "number" }
},
"publishAt": { "from": "Available", "format": "yyyy-MM-dd", "tz": "site" },
"rules": {
"mode": "upsert",
"updateFields": ["price"],
"protectEdited": true
}
}
  • mode: "upsert", "create" or "update". Default "upsert".
  • updateFields: 1 to 200 mapping names: a field name, slug, taxonomies.<name> or bylines. Each must be mapped, once.
  • protectEdited: true to keep changes made in the admin.
  • publishAt: from (a source key) or expr (an expression), with an optional format, and tz set to an IANA timezone, site, or UTC (the default).

updateFields and protectEdited can’t be combined with "mode": "create".

Whether entries are published or kept as drafts is not part of the template: it is set for each run (the wizard’s Status, a schedule’s Imported entries, or publish in the API). Publishing is the default.