deploying-ui-bundle

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Deploying a UI Bundle

部署UI Bundle

The order of operations is critical when deploying to a Salesforce org. This sequence reflects the canonical flow.
部署到Salesforce org时,操作顺序至关重要。以下流程为标准规范流程。

Step 1: Org Authentication

Step 1: Org认证

Check if the org is connected. If not, authenticate. All subsequent steps require an authenticated org.
检查org是否已连接。若未连接,则进行认证。后续所有步骤均需要已认证的org。

Step 2: Pre-deploy UI Bundle Build

Step 2: 部署前UI Bundle构建

Install dependencies and build the UI bundle to produce
dist/
. Required before deploying UI bundle entities.
Run when: deploying UI bundles and
dist/
is missing or source has changed.
安装依赖并构建UI Bundle以生成
dist/
目录。部署UI Bundle实体前必须完成此步骤。
执行时机:部署UI Bundle且
dist/
目录缺失或源码已更改时。

Step 3: Deploy Metadata

Step 3: 元数据部署

Check for a manifest (
manifest/package.xml
or
package.xml
) first. If present, deploy using the manifest. If not, deploy all metadata from the project.
Deploys objects, layouts, permission sets, Apex classes, UI bundles, and all other metadata. Must complete before schema fetch — the schema reflects org state.
首先检查是否存在清单文件(
manifest/package.xml
package.xml
)。若存在,则使用清单进行部署;若不存在,则部署项目中的所有元数据。
部署对象、布局、权限集、Apex类、UI Bundle及所有其他元数据。必须在获取schema前完成此步骤——schema反映org的状态。

Step 4: Post-deploy Configuration

Step 4: 部署后配置

Deploying does not mean assigning. After deployment:
  • Permission sets / groups — assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
  • Profiles — ensure users have the correct profile.
  • Other config — named credentials, connected apps, custom settings, flow activation.
Proactive behavior: after a successful deploy, discover permission sets in
force-app/main/default/permissionsets/
and assign each one (or ask the user).
完成部署并不意味着权限已分配。部署完成后:
  • 权限集/用户组 —— 分配给用户,使其能够访问自定义对象和字段。这是GraphQL自省返回正确schema的必要条件。
  • Profiles(配置文件) —— 确保用户拥有正确的配置文件。
  • 其他配置 —— 命名凭据、连接应用、自定义设置、流激活。
主动操作:部署成功后,自动发现
force-app/main/default/permissionsets/
目录下的权限集并逐一分配(或询问用户)。

Step 5: Data Import (optional)

Step 5: 数据导入(可选)

Only if
data/data-plan.json
exists. Delete runs in reverse plan order (children before parents). Import uses Anonymous Apex with duplicate rule save enabled.
Always ask the user before importing or cleaning data.
仅当
data/data-plan.json
文件存在时执行。删除操作按计划逆序执行(先删除子对象,再删除父对象)。导入使用启用重复规则保存的匿名Apex。
执行数据导入或清理前必须询问用户。

Step 6: GraphQL Schema and Codegen

Step 6: GraphQL Schema与codegen(代码生成)

  1. Set default org
  2. Fetch schema (GraphQL introspection) — writes
    schema.graphql
    at project root
  3. Generate types (codegen reads schema locally)
Run when: schema missing, or metadata/permissions changed since last fetch.
  1. 设置默认org
  2. 获取schema(GraphQL自省)—— 在项目根目录生成
    schema.graphql
    文件
  3. 生成类型(codegen从本地读取schema)
执行时机:schema缺失,或自上次获取后元数据/权限已更改时。

Step 7: Final UI Bundle Build

Step 7: 最终UI Bundle构建

Build the UI bundle if not already done in Step 2.
若Step 2中未完成UI Bundle构建,则在此步骤执行。

Summary: Interaction Order

总结:交互顺序

  1. Check/authenticate org
  2. Build UI bundle (if deploying UI bundles)
  3. Deploy metadata
  4. Assign permissions and configure
  5. Import data (if data plan exists, with user confirmation)
  6. Fetch GraphQL schema and run codegen
  7. Build UI bundle (if needed)
  1. 检查/认证org
  2. 构建UI Bundle(若部署UI Bundle)
  3. 部署元数据
  4. 分配权限并完成配置
  5. 导入数据(若存在数据计划,需用户确认)
  6. 获取GraphQL schema并执行codegen
  7. 构建UI Bundle(若需要)

Critical Rules

关键规则

  • Deploy metadata before fetching schema — custom objects/fields appear only after deployment
  • Assign permissions before schema fetch — the user may lack FLS for custom fields
  • Re-run schema fetch and codegen after every metadata deployment that changes objects, fields, or permissions
  • Never skip permission set assignment or data import silently — either run them or ask the user
  • 必须在获取schema之前部署元数据——自定义对象/字段仅在部署后才会显示
  • 必须在获取schema之前分配权限——用户可能缺少自定义字段的字段级安全性(FLS)权限
  • 每次更改对象、字段或权限的元数据部署完成后,必须重新执行schema获取和codegen
  • 不得静默跳过权限集分配或数据导入——要么执行,要么询问用户

Post-deploy Checklist

部署后检查清单

After every successful metadata deploy:
  1. Discover and assign permission sets (or ask the user)
  2. If
    data/data-plan.json
    exists, ask the user about data import
  3. Re-run schema fetch and codegen from the UI bundle directory
每次元数据部署成功后:
  1. 发现并分配权限集(或询问用户)
  2. data/data-plan.json
    文件存在,询问用户是否进行数据导入
  3. 从UI Bundle目录重新执行schema获取和codegen