Field Types
Caseblocks v2 API provides a comprehensive set of field types to capture and manage different types of data. Each field type is designed for specific use cases and includes built-in validation, formatting, and user interface controls.
Available Field Types
Basic Data Types
- String - Text input fields for names, titles, descriptions, and short text content
- Number - Numeric fields for quantities, amounts, measurements, and calculations
- Date - Date and time fields with timezone support and flexible formatting
- Boolean - True/false fields for binary choices and status flags
- Email Address - Email fields with built-in validation and formatting
Complex Data Types
- Entity - Complex fields containing nested fields for structured data
- Multi Value - Fields for selecting multiple values from predefined options
- Case Type States - Fields for case state selection from predefined states
- Relation - Fields for creating relationships between different case types
Specialized Field Types
- Address - Address fields with geocoding support
- Location - Location fields with coordinate support
- Document - File and document upload fields
- Select - Dropdown selection fields with predefined options
- Checkbox - Checkbox input fields for binary choices
- Cascading Options - Dependent dropdown fields with dynamic options
- Currency - Currency fields with symbol and precision support
- Status - Status fields for workflow state management
- Rich Text - Rich text editor fields for formatted content
- Text Area - Multi-line text input fields
- Embedded Table - Table fields for structured data entry
Common Field Attributes
All field types support the following common attributes:
- name (string, required) - Unique identifier for the field
- type (string, required) - Field type identifier
- display_name (string, optional) - Human-readable field label
- guidance (string, optional) - Help text and instructions
- required (boolean, optional) - Whether the field is mandatory
- readonly (boolean, optional) - Whether the field is read-only
- hidden (boolean, optional) - Whether the field is hidden from UI
- default_value (varies, optional) - Default value for the field
- validation (string, optional) - Validation rules
- validation_message (string, optional) - Custom validation error message
Field Type Selection Guide
Text and Content
- Use String for short text inputs like names, titles, and identifiers
- Use Text Area for longer text content like descriptions and notes
- Use Rich Text for formatted content with styling options
- Use Email Address for email addresses with validation
Numbers and Calculations
- Use Number for quantities, amounts, and measurements
- Use Currency for monetary values with currency symbols
- Use Number with formulas for calculated fields
Dates and Time
- Use Date for dates, times, and timestamps
- Configure timezone handling for global applications
- Use validation for date ranges and constraints
Choices and Selections
- Use Select for single-choice dropdowns
- Use Multi Value for multiple selections
- Use Checkbox for simple yes/no choices
- Use Boolean for true/false flags
- Use Cascading Options for dependent dropdowns
Complex Data
- Use Entity for grouped related fields
- Use Embedded Table for structured data entry
- Use Relation for linking to other case types
- Use Case Type States for workflow state management
Specialized Data
- Use Address for location addresses with geocoding
- Use Location for coordinate-based locations
- Use Document for file uploads and attachments
- Use Status for workflow status tracking
Best Practices
Field Naming
- Use descriptive, consistent naming conventions
- Avoid special characters in field names
- Use lowercase with underscores for field names
Validation
- Apply appropriate validation rules for data integrity
- Provide clear validation error messages
- Consider business rules and constraints
User Experience
- Provide clear labels and guidance text
- Use appropriate field types for the data being collected
- Consider form layout and field grouping
Performance
- Optimize field configurations for large datasets
- Use appropriate indexing for searchable fields
- Consider pagination for large multi-value fields
Data Modeling
- Plan field relationships and dependencies
- Consider data normalization and denormalization
- Design for scalability and maintainability
Examples
Simple Contact Form
- name: first_name
type: string
display_name: "First Name"
required: true
- name: last_name
type: string
display_name: "Last Name"
required: true
- name: email
type: email_address
display_name: "Email Address"
required: true
- name: phone
type: string
display_name: "Phone Number"
required: false
Complex Order Form
- name: customer_info
type: entity
display_name: "Customer Information"
fields:
- name: name
type: string
required: true
- name: email
type: email_address
required: true
- name: items
type: entity
cardinality: "oneToMany"
fields:
- name: product
type: string
required: true
- name: quantity
type: number
required: true
- name: price
type: currency
required: true
- name: status
type: case_type_states
display_name: "Order Status"
required: true
This comprehensive field type system provides the flexibility and power needed to build complex, data-rich applications while maintaining consistency and usability.