Skip to content

CRM 0.13.0: CRM attachment folders under a parent you choose

CRM 0.13.0 lets your app decide where the CRM creates attachment folders for contacts, companies and interactions, instead of always at the top of the media library. It also fixes a bug that could send uploads into, and trash files from, a folder that was not the CRM’s.

A parent folder for CRM media

Each CRM record with files gets its own folder in the media library, created at the storage root. A host app can now point new folders elsewhere:

config :phoenix_kit_crm, :attachments_parent_folder, {MyApp.Media, :for_crm}

The function is called with the kind (:contact, :company or :interaction), the acting user’s id and, if it takes three arguments, the record’s id. It returns {:ok, folder_uuid}, or nil for the root. The setting only decides where a new folder goes. An existing folder is still found by its name wherever it is: under the parent, at the root, or wherever someone moved it in /admin/media. Turning the setting on, pointing it somewhere else or moving folders by hand never strands files or creates a second folder.

The function also runs when a record’s media tab or timeline loads, so keep it cheap. If it fails or returns anything else, the CRM uses the root.

Images folder fix

Inside each record’s folder the CRM keeps an Images subfolder. It used to look that name up at the storage root as well, so a site with its own top-level Images folder could have CRM uploads go there, and removing an image in the CRM could trash the site’s own files. The subfolder is now looked up only inside the record’s own folder.

Upgrading

No migration. Update the dependency. Nothing changes until you add the :attachments_parent_folder setting; existing folders stay where they are and keep working.

Full release notes: CRM 0.13.0

0.13.0 · 15 September 2026

Added

  • Attachment folders can be created under a host-configured parent (config :phoenix_kit_crm, :attachments_parent_folder, {mod, fun}, called as fun(kind, actor_uuid, record_uuid) or fun(kind, actor_uuid)). The parent decides where a new folder goes; existing folders are found by name wherever they live — under the parent, at the root, or moved elsewhere — so turning the setting on, re-pointing it, or moving a folder in /admin/media never strands media or creates a twin.

Fixed

  • A record’s Images subfolder is resolved only inside its own folder. A host’s own top-level Images folder could otherwise be picked up as the record’s Images folder, sending uploads there and letting Remove trash the host’s files.
  • HexDocs source links point at the v-prefixed release tag.

CRM 0.13.0. Install or update: {:phoenix_kit_crm, "~> 0.13"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.