Steedos Objects | Steedos 对象定义
Overview | 概述
Steedos objects are the foundation of your data model. Each object represents a database table. Objects are defined using
files, with related metadata (fields, list views, permissions, buttons) in separate files within subfolders.
Steedos 对象是数据模型的基础。每个对象代表一个数据库表。对象使用
文件定义,相关元数据(字段、列表视图、权限、按钮)在子文件夹的独立文件中定义。
File Location | 文件位置
Modern Format (Recommended) | 现代格式(推荐)
Each object has its own folder with separate metadata files:
steedos-packages/
└── my-package/
└── main/default/
└── objects/
└── orders/
├── orders.object.yml # Object definition
├── fields/ # Field definitions
│ ├── order_number.field.yml
│ ├── customer.field.yml
│ ├── status.field.yml
│ └── total_amount.field.yml
├── listviews/ # List view definitions
│ ├── all.listview.yml
│ ├── my_orders.listview.yml
│ └── pending.listview.yml
├── permissions/ # Permission definitions
│ ├── user.permission.yml
│ └── admin.permission.yml
└── buttons/ # Button definitions
├── submit_order.button.yml
└── standard_delete.button.yml
Note: Triggers and functions are in separate top-level folders:
main/default/
├── triggers/
│ └── orders_validate.trigger.yml
└── functions/
└── approve_order.function.yml
Object Definition | 对象定义
Minimal Object | 最小对象定义
yaml
# objects/products/products.object.yml
name: products
label: 产品
custom: true
Every object must have a name field. At minimum, define a
field:
每个对象必须有一个名称字段。至少需要定义一个
字段:
yaml
# objects/products/fields/name.field.yml
name: name
type: text
label: 产品名称
required: true
searchable: true
Fields, list views, and permissions are defined in separate files under the object folder.
Complete Object | 完整对象定义
yaml
# objects/orders/orders.object.yml
name: orders
label: 订单
icon: orders
custom: true
version: 2
is_enable: true
enable_search: true
enable_files: true
enable_api: true
enable_audit: true
enable_trash: true
enable_enhanced_lookup: true
enable_inline_edit: true
enable_dataloader: true
Core Properties | 核心属性
Basic Properties | 基本属性
| Property | Type | Required | Description |
|---|
| string | Yes | Object API name (snake_case) |
| string | Yes | Display label (use the language of the user's prompt) |
| string | No | MUST be a value from the Valid Icon Values list below. Do NOT invent icon names. |
| boolean | No | Mark as custom object |
| number | No | Object schema version |
| boolean | No | Object is active |
Feature Flags | 功能开关
| Property | Type | Default | Description |
|---|
| boolean | true | Enable global search |
| boolean | false | Enable file attachments |
| boolean | true | Enable API access |
| boolean | false | Enable field history tracking |
| boolean | true | Enable recycle bin |
| boolean | true | Enhanced lookup UI |
| boolean | false | Inline editing in list views |
| boolean | false | Bulk operation support |
| boolean | false | Workflow support |
| boolean | false | Record locking |
Field Groups | 字段分组
Organize fields into collapsible groups in the UI:
yaml
# objects/orders/orders.object.yml
field_groups:
- group_name: Basic Information
- group_name: Shipping Details
collapsed: true
- group_name: Approval Info
collapsed: true
visible_on: "{{status != 'draft'}}"
Name Field (Required) | 名称字段(必填)
Every object must have a name field — this is the human-readable identifier displayed in lookup results, related lists, breadcrumbs, and record titles. There are two ways to provide it:
每个对象必须有一个名称字段——它是在查找结果、相关列表、面包屑和记录标题中显示的人类可读标识。有两种方式提供:
Option 1: Define a field (default) | 方式一:定义 字段(默认)
If you define a field with
, it is automatically used as the name field:
yaml
# objects/products/fields/name.field.yml
name: name
type: text
label: 产品名称
required: true
searchable: true
index: true
Option 2: Use on another field | 方式二:在其他字段上设置
When the record title is not a simple text field (e.g., an autonumber or a lookup), mark a different field with
:
当记录标题不是简单文本字段时(例如自动编号或查找字段),在其他字段上标记
:
yaml
# objects/orders/fields/order_number.field.yml
name: order_number
type: autonumber
label: 订单号
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
is_name: true
readonly: true
sort_no: 100
yaml
# objects/permission_objects/fields/permission_set.field.yml
name: permission_set
type: master_detail
label: 权限集
reference_to: permission_set
required: true
is_name: true
Resolution priority:
takes precedence over a field named
. If neither exists, the object will have no display name and lookups/related lists will show blank values.
优先级规则:
优先于名为
的字段。如果两者都不存在,对象将没有显示名称,查找/相关列表将显示空白值。
Standard Fields | 标准字段
Steedos automatically adds these system fields to every object (no need to define):
| Field | Type | Description |
|---|
| text | Record ID (primary key) |
| text | Record name/title (see Name Field section above) |
| lookup → users | Record owner |
| lookup → spaces | Workspace ID |
| datetime | Creation date |
| lookup → users | Creator |
| datetime | Last modified date |
| lookup → users | Last modifier |
| lookup → company | Primary company |
| lookup → company (multiple) | Associated companies |
Complete Example | 完整示例
Object with Separate Files | 带独立文件的对象
Object definition:
yaml
# objects/orders/orders.object.yml
name: orders
label: 订单
icon: orders
custom: true
version: 2
is_enable: true
enable_search: true
enable_files: true
enable_api: true
enable_audit: true
enable_trash: true
enable_enhanced_lookup: true
field_groups:
- group_name: Basic Information
- group_name: Financial
- group_name: Shipping
collapsed: true
Field files:
yaml
# objects/orders/fields/order_number.field.yml
name: order_number
type: autonumber
label: 订单号
formula: 'ORD-{YYYY}{MM}{DD}-{0000}'
is_name: true
readonly: true
sort_no: 100
yaml
# objects/orders/fields/customer.field.yml
name: customer
type: lookup
label: 客户
reference_to: customers
required: true
index: true
sort_no: 200
yaml
# objects/orders/fields/status.field.yml
name: status
type: select
label: 状态
required: true
index: true
sort_no: 300
options:
- label: 草稿
value: draft
- label: 已提交
value: submitted
- label: 已批准
value: approved
- label: 已完成
value: completed
- label: 已取消
value: cancelled
yaml
# objects/orders/fields/total_amount.field.yml
name: total_amount
type: currency
label: 总金额
scale: 2
readonly: true
group: Financial
sort_no: 400
List view file:
yaml
# objects/orders/listviews/all.listview.yml
name: all
label: 所有订单
is_enable: true
shared: true
filter_scope: space
crud_mode: table
columns:
- field: order_number
- field: customer
- field: total_amount
- field: status
- field: created
sort:
- field_name: created
order: desc
searchable_fields:
- field: order_number
- field: customer
Permission file:
yaml
# objects/orders/permissions/user.permission.yml
name: orders.user
permission_set_id: user
allowCreate: true
allowRead: true
allowEdit: true
allowDelete: false
viewAllRecords: true
modifyAllRecords: false
Button file:
yaml
# objects/orders/buttons/submit_order.button.yml
name: submit_order
label: 提交
type: amis_button
on: record_only
is_enable: true
visible: true
amis_schema: |-
{
"type": "button",
"label": "Submit",
"level": "primary",
"visibleOn": "${status == 'draft'}",
"onEvent": {
"click": {
"actions": [
{
"actionType": "ajax",
"api": {
"url": "/api/v1/orders/functions/submit_order",
"method": "post",
"requestAdaptor": "api.data = { id: api.body.recordId }",
"messages": { "success": "Order submitted" }
}
},
{ "actionType": "broadcast", "args": { "eventName": "steedos:record:reload" } }
]
}
}
}
Naming Conventions | 命名规范
yaml
# Object names: lowercase, plural, underscores for multi-word
name: customers # Good
name: sales_orders # Good
name: SalesOrders # Bad - no CamelCase
name: sales-orders # Bad - no hyphens
# Field names: lowercase, underscores
customer_name # Good
orderDate # Bad - no camelCase
Object Relationships | 对象关系
- lookup: One-to-many (no cascade delete)
- master_detail: Parent-child (cascade delete, child inherits sharing)
See the object-fields skill for detailed relationship field configuration.
Icon Reference | 图标参考
⚠️ CRITICAL: The value MUST be chosen from the valid icon list below. NEVER invent or guess icon names. If no icon matches the object's domain, use or as a safe default.
The object
property uses Salesforce Lightning Design System (SLDS) icons — the same icon set as the application
property.
对象的
属性使用 Salesforce Lightning Design System (SLDS) 图标——与应用的
属性使用相同的图标集。
⚠️ 重要: 值必须从下方有效值列表中选取,严禁自行编造图标名称。如果没有匹配的图标,使用 或 作为默认值。
Common Icons by Category | 常用图标分类
| Category | Recommended Icons |
|---|
| CRM/Sales | , , , , , |
| Contracts | , , |
| Projects | , , , , |
| HR/People | , , , , |
| Finance | , , , , |
| Content | , , , , |
| Products | , , , , |
| Orders | , , , |
| Dashboard | , , , , |
| Admin | , , , |
| Communication | , , , , |
| Approval | , , , |
| Location | , , , |
| Quality/Inspection 质检巡检 | , , , , |
| Equipment/Maintenance 设备维保 | , , , |
| Service 服务 | , , , |
| Generic | , , , , |
Valid icon Values | 有效的 icon 值
⚠️ ONLY the values listed below are valid. Any value NOT in this list will cause a broken icon. When in doubt, use or .
The following is the
complete and exhaustive list of valid
values (same as application
):
以下是
的
完整且唯一有效值列表(与应用的
相同),不在此列表中的值会导致图标无法显示:
A:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
B:
,
,
,
,
,
,
,
,
,
,
C:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
customer_lifecycle_analytics
,
,
D:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
E:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
F:
,
,
,
,
,
,
,
,
,
,
,
,
,
L:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
M:
,
,
,
,
,
,
med_rec_statement_recommendation
,
,
,
,
medication_reconciliation
,
,
,
,
,
,
,
,
O:
,
,
,
,
,
,
,
,
,
,
P:
,
,
,
,
,
,
,
patient_medication_dosage
,
,
,
,
,
,
,
,
,
,
,
,
,
,
portal_roles_and_subordinates
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
product_request_line_item
,
,
,
product_service_campaign_item
,
,
,
,
,
,
,
,
,
,
R:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
S:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
serialized_product_transaction
,
,
service_appointment_capacity_usage
,
,
,
,
,
,
,
,
,
service_territory_location
,
,
,
,
,
,
,
,
shift_scheduling_operation
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
system_and_global_variable
T:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
V:
,
variation_attribute_setup
,
,
,
,
,
,
W:
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
Usage Examples | 使用示例
yaml
# CRM object
name: accounts
icon: account
# Order management
name: orders
icon: orders
# HR object
name: employees
icon: employee
# Approval process
name: process_definition
icon: approval
# Custom settings
name: app_settings
icon: settings
Best Practices | 最佳实践
- Always define a name field: Either a field named or a field with — without this, lookups and related lists show blank values
- Use separate files: Put fields, listviews, permissions, and buttons in their own files for better version control
- Label follows user's language: Write in the language of the user's prompt. For internationalization, use the translations skill
- Add indexes: Set on frequently queried fields
- Choose valid icons ONLY: The value MUST exist in the valid icon values list. Never invent icon names. Use or if no specific icon fits. Common mappings: 质检/检验→, 巡检→, 设备→, 工单→, 审批→
- Use field groups: Organize related fields into collapsible groups
- Name objects as plurals: , , (not singular)