Custom Fields

Company-scoped definitions that extend entities with structured fields. Definitions live on the Company; values live on each entity in its customFields.


Setup

  • Open Company settings and navigate to Custom Fields.
  • Add definitions for the entities you want to extend (e.g., Item, Variant, Delivery, Delivery Item, Stock).
  • Each definition supports a type, default value, optional enum values, and a required flag.
  • Save. New and existing records of those entities will expose a customFields object where values are stored.

Definitions Schema

company.schema.ts
1// Company model (excerpt) 2model Company { 3 // ... 4 customFieldDefinitions Json? @default('{"json":[]}') 5 // ... 6} 7 8// Zod schema for definitions 9export const CustomFieldDefinitionsSchema = z 10 .array( 11 z.object({ 12 id: z.string().optional(), 13 name: z.string(), 14 description: z.string().optional(), 15 type: z.enum(["string", "number", "boolean", "enum"]), 16 default: z.union([z.string(), z.number(), z.boolean()]).optional(), 17 enumValues: z.array(z.string()).nullable().optional(), 18 entity: EntitiesWithCustomFieldsSchema, // e.g. "Item", "Variant", "Delivery", "DeliveryItem", "Stock" 19 required: z.boolean().default(false), 20 }), 21 ) 22 .default([]) 23 .nullable()

Supported Entities

Item (Product)

Extend catalog items with additional attributes like brand, material, or compliance codes.

Variant

Capture variant-level specifics like pack labeling, shelf life classification, or handling notes.

Delivery & Delivery Item

Track inbound receiving metadata such as external references, carrier info, or QA checks.

Stock

Attach lot-specific or location-specific attributes such as batch, condition, or notes.

Values on Entities

Each supported entity has a customFields JSON object where values are stored under the definition id (GUID) keys. Required fields are validated on the server.

example.custom-fields.json
1{ 2 "2f7a9b3e-1c2d-4a5b-8e9f-0a1b2c3d4e5f": "Acme", // brand 3 "41c2e4a8-2e7f-4db9-a1b2-1f2e3d4c5b6a": "Cotton", // material 4 "a3b2c1d4-e5f6-4a7b-9c8d-0e1f2a3b4c5d": 2, // priority 5 "0f1e2d3c-4b5a-6978-80a9-b1c2d3e4f5a6": false, // hazmat 6 "9a8b7c6d-5e4f-3a2b-1c0d-e1f2a3b4c5d6": "New", // condition 7 "c1d2e3f4-a5b6-7890-1a2b-3c4d5e6f7a8b": "DEL-12345" // externalRef 8}

FAQ

Copyright © 2025 Stockmate
All rights reserved