Define organization-specific fields without code changes
Custom fields let you add organization-specific columns to your RFQ line items without modifying code. They're stored as JSONB in the database (rfq_lines.custom_fields column) and validated automatically on both client and server.
Custom fields are managed at the organization level. Only users with Owner or Admin role can create/modify field definitions.
Dashboard → Settings → Custom Fields
If you don't see "Custom Fields" in settings, your role is Buyer or Manager. Ask your organization owner to grant you Admin access.
Plan your custom fields before creating them. You cannot rename field keys after creation (data integrity constraint).
Each custom field needs a definition specifying its key, label, type, and validation rules. Field definitions are stored in the custom_field_definitions table.
Field keys must be alphanumeric with underscores only (^[a-z0-9_]+$). Once created, they cannot be changed due to data integrity. Good: material_grade, Bad: material-grade or materialGrade
Once defined, custom fields appear automatically in RFQ forms, Excel imports, and supplier quote forms.
Add columns matching your field keys (case-insensitive). E.g., if field_key is "material_grade", Excel column can be "Material Grade" or "material_grade". Auto-mapped during import.
Suppliers see your custom field values (read-only) when quoting. They cannot edit them but can reference them in their pricing or notes.
QuoteBase validates custom fields in two layers: client-side (instant UI feedback) and server-side (data integrity enforcement).
Function: validateCustomFields() in lib/custom-fields/validate.ts. Uses Zod schemas generated from field definitions. Validates on form submit and real-time on field blur.
PostgreSQL function: validate_custom_fields_json(jsonb, uuid). Called via trigger on rfq_lines INSERT/UPDATE. Rejects transactions if validation fails. Protects against API bypass.
Max JSONB size: 64KB per rfq_line row. If you have 100+ custom fields with long text values, you may hit this limit. Consider storing large data (PDFs, images) as file attachments instead.
Follow these guidelines to get the most out of custom fields without creating maintenance headaches.