System: Platform Foundation (PF)Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Feature: Entity Field Configuration (PF-17)
Created: 2025-12-05
Status: ✅ Complete
Quick Reference
When to Use Field Configuration:- ✅ You need to hide fields by role (salary visible to admins only)
- ✅ You need to make fields required by context (required on edit, optional on create)
- ✅ You need to control field order in entity forms
- ✅ You need conditional visibility (show field B when field A = “Yes”)
- ❌ You need to add a new field → Use Custom Fields (PF-16)
- ❌ You need to create new entity → Use Custom Objects (PF-24)
- ❌ You need to create form layout → Use Form Builder (FW-01)
- ❌ You need dropdown options → Use Picklists (PF-15)
What Is Field Configuration?
Field Configuration controls how existing fields behave in entity forms and views. It defines visibility rules, required status, field ordering, and conditional logic without changing the underlying data schema. Key Characteristics:- Context-aware (different rules for create vs edit vs view)
- Role-based (visibility varies by user role)
- Conditional (show/hide based on other field values)
- Non-destructive (doesn’t modify data schema)
pf_entity_field_configs table
Common Use Cases
Use Case 1: Hide Salary from Non-Admins
Scenario: Your organization tracks employee salaries, but only HR managers and admins should see salary information. Solution: Configure Field Visibility (PF-17) Why Field Configuration:- Controlling existing field (hr_employees.salary)
- Role-based visibility
- Field exists in schema (not adding new field)
- Go to Settings → Field Configuration
- Select entity:
hr_employees - Find field:
salary - Set visibility rules:
- View Context:
edit_form - Visible to roles:
['org_admin', 'hr_manager'] - Hidden from roles:
['staff', 'viewer']
- View Context:
- Save configuration
- Salary field only visible to admins/managers
- Not adding new field (salary exists in schema)
- Controlling visibility (not defining new data)
Use Case 2: Require Fields by Context
Scenario: On employee creation, department is optional. On employee edit, department is required. Solution: Configure Required Rules (PF-17) Why Field Configuration:- Controlling existing field behavior
- Context-dependent requirements
- Different rules for create vs edit
- Go to Settings → Field Configuration
- Select entity:
hr_employees - Find field:
department_id - Set required rules:
- Create form:
required: false - Edit form:
required: true
- Create form:
- Save configuration
- Department optional on create, required on edit
- Flexible data entry on create
- Enforce completeness on edit
- Same field, different requirements by context
Use Case 3: Conditional Field Visibility
Scenario: Show “License Expiration Date” only when “Has License” is checked. Solution: Configure Conditional Visibility (PF-17) Why Field Configuration:- Conditional show/hide logic
- Based on other field values
- Dynamic form behavior
- Go to Settings → Field Configuration
- Select entity:
hr_employees - Find field:
license_expiration_date - Add conditional rule:
- Save configuration
- Expiration date only shows when “Has License” = true
- Cleaner forms (hide irrelevant fields)
- Better UX (context-aware forms)
- No code changes needed
Use Case 4: Reorder Fields in Forms
Scenario: You want to show “Emergency Contact” fields at the top of employee forms, not at the bottom. Solution: Configure Field Order (PF-17) Why Field Configuration:- Controlling field display order
- Improving UX (important fields first)
- No schema changes needed
- Go to Settings → Field Configuration
- Select entity:
hr_employees - Set display_order for fields:
emergency_contact_name: 1emergency_contact_phone: 2first_name: 3last_name: 4- etc.
- Save configuration
- Emergency contact fields appear first
When NOT to Use Field Configuration
❌ Don’t Use Field Configuration For: Adding New Fields
Example: “I need to add badge_number to employees” Why Not Field Configuration:- Adding new field (not controlling existing)
- Need to define data type, validation
- New data storage needed
❌ Don’t Use Field Configuration For: Creating Forms
Example: “I need to create an intake form” Why Not Field Configuration:- Creating new form (not configuring entity fields)
- Form with its own fields
- One-time data capture
❌ Don’t Use Field Configuration For: Creating Entities
Example: “I need to track Clinical Licenses” Why Not Field Configuration:- Creating new entity type
- Not configuring existing entity
Integration with Other Systems
Field Configuration + Custom Fields (PF-16)
Use Case: Control visibility of custom fields Example: Hide “Badge Number” custom field from non-admins Implementation:- Create custom field (PF-16):
badge_number - Configure visibility (PF-17):
- Entity: hr_employees
- Field:
custom_fields.badge_number(or referenced by field_definition_id) - Visible to roles:
['org_admin']
- Custom field respects visibility configuration
- Custom fields integrate with field configuration
- Consistent visibility control
Field Configuration + Picklists (PF-15)
Use Case: Conditional field based on picklist value Example: Show “Contractor Details” section when Employment Status = “Contract” Implementation:- Create picklist (PF-15):
employment_status - Add picklist item:
contract - Configure conditional visibility (PF-17):
- Field:
contractor_company - Condition:
employment_status == 'contract'
- Field:
- Contractor fields only show for contractors
Field Configuration + DynamicFormRenderer
Use Case: Render entity forms with field configuration applied Example: Employee edit form with role-based visibility Implementation:- Filters fields by role-based visibility
- Applies conditional visibility rules
- Orders fields by display_order
- Enforces required rules by context
Decision Tree
Configuration Options
Visibility Rules
| Option | Description | Example |
|---|---|---|
visible_to_roles | Roles that can see field | ['org_admin', 'hr_manager'] |
hidden_from_roles | Roles that cannot see field | ['viewer', 'guest'] |
view_contexts | Contexts where field appears | ['edit_form', 'detail_view'] |
Required Rules
| Option | Description | Example |
|---|---|---|
required_on_create | Required when creating | true / false |
required_on_edit | Required when editing | true / false |
required_conditions | Conditional requirement | { field: 'status', value: 'active' } |
Conditional Visibility
| Operator | Description | Example |
|---|---|---|
equals | Field equals value | { field: 'type', operator: 'equals', value: 'contract' } |
not_equals | Field doesn’t equal value | { operator: 'not_equals', value: null } |
contains | Array contains value | { operator: 'contains', value: 'admin' } |
is_empty | Field is empty/null | { operator: 'is_empty' } |
is_not_empty | Field has value | { operator: 'is_not_empty' } |
Best Practices
1. Use Role-Based Visibility for Sensitive Data
✅ Do: Hide salary, SSN, compensation from non-privileged roles❌ Don’t: Rely only on RLS (field config provides UI-level hiding)
2. Make Fields Required Progressively
✅ Do: Optional on create, required on edit (allow incomplete records initially)❌ Don’t: Require everything on create (blocks quick data entry)
3. Use Conditional Visibility to Simplify Forms
✅ Do: Hide irrelevant fields based on other values❌ Don’t: Show all fields all the time
4. Group Related Fields
✅ Do: Use display_order to group related fields together❌ Don’t: Scatter related fields throughout form
5. Document Configuration Decisions
✅ Do: Add notes explaining why fields are hidden/required❌ Don’t: Configure without documentation
Common Mistakes
Mistake 1: Using Field Config for New Fields
Problem: Trying to add new fields via field configurationSolution: Use Custom Fields (PF-16) first, then configure with PF-17
Mistake 2: Over-Hiding Fields
Problem: Hiding too many fields, users can’t find informationSolution: Balance visibility - hide sensitive data, not all data
Mistake 3: Complex Conditional Chains
Problem: Field A shows Field B which shows Field C which shows Field DSolution: Keep conditional logic simple (max 2 levels)
Mistake 4: Inconsistent Required Rules
Problem: Field required on edit but data entered on create can’t be emptySolution: If required on edit, guide users to fill on create too
Related Documentation
- PF-17: Entity Field Configuration Spec
- PF-16: Custom Field Definitions Spec
- Custom Fields Use Case Guide
- Clarity Analysis
Last Updated: 2025-12-05
Next Review: After user feedback