Skip to main content

Overview

This guide explains how to migrate from hardcoded enums to organization-scoped picklists using the PF-15 Picklist System.

Why Migrate?

  • Organization customization: Each org can customize values
  • Admin UI management: Non-developers can add/edit options
  • Color coding: Items can have associated colors for UI display
  • Soft-delete: Items can be deactivated without breaking existing data

Migration Steps

1. Identify Enum Usage

Find all places where you’re using hardcoded enums:

2. Create Picklist (Admin or Migration)

Either create via Admin UI or database migration:

3. Use Backward-Compatible Hook

During migration, use usePicklistByEnum for backward compatibility:

4. Use PicklistSelector in Forms

Seeded Picklists

The following system picklists are automatically seeded:

Best Practices

  1. Always use usePicklistByEnum during migration for backward compatibility
  2. Mark system picklists with is_system: true to prevent accidental deletion
  3. Use semantic picklist names that match the database enum names
  4. Include colors in metadata for status-type picklists