# `MishkaCmsMigration.Resources.Validations.MappedRecord`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration/resources/__validations/mapped_record.ex#L5)

Holds an item's `mapped_id` (`MishkaCmsMigration.MigrationItem`'s `:choose`) to a record the item
may be mapped to: one of the CMS resource its kind is written to (`MishkaCmsMigration.Target`),
on the item's site, that the admin may read. `nil`, importing the item as its own, is always
taken.

    update :choose do
      validate MishkaCmsMigration.Resources.Validations.MappedRecord,
        before_action?: true,
        where: [changing(:mapped_id)]
    end

The record is read as the admin, under the item's site and the CMS's own policies
(`MishkaCmsMigration.Targets.Helpers.Read`), so another site's record, another kind's, one that
is gone and one the admin may not read are all refused the same way, on `mapped_id`. Run it with
`before_action?: true`, after the policies have let the admin make the choice.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
