Business Process Flows 标志

Business Process Flows

社区
korchard333
business-process-flows

业务流程流(BPF)。适用于:创建 BPF、BPF 阶段、BPF 分支、跨实体 BPF、通过 API 创建 BPF XAML、激活 BPF、BPF 客户端 JavaScript,以及流程实例管理。

Add to TypingMind

概览

发布者korchard333
代码仓库claude-power-platform-community
技能名称business-process-flows
星标数
50
复刻数
6
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 korchard333 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Business Process Flows AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/korchard333/claude-power-platform-community/tree/main/.claude/skills/business-process-flows
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/korchard333/claude-power-platform-community.git /tmp/claude-power-platform-community
mkdir -p .claude/skills
cp -r /tmp/claude-power-platform-community/.claude/skills/business-process-flows .claude/skills/business-process-flows
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Business Process Flows,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Business Process Flows。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Business Process Flows 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Skill: Business Process Flows

When to Use

Trigger when designing, creating, or managing Business Process Flows (BPFs) in Model-Driven Apps.


BPF Overview

Business Process Flows guide users through a defined set of stages to complete a business process. They appear as a horizontal stage bar at the top of Model-Driven App forms.

┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐
│  Qualify     │ → │  Develop     │ → │  Propose     │ → │  Close       │
│  ○ Budget    │    │  ○ Contacts  │    │  ○ Proposal  │    │  ○ Decision  │
│  ○ Timeline  │    │  ○ Needs     │    │  ○ Review    │    │  ○ Sign-off  │
│  ○ Authority │    │  ○ Solution  │    │  ○ Pricing   │    │  ○ Order     │
└─────────────┘    └─────────────┘    └─────────────┘    └─────────────┘

When to Use BPF vs Alternatives

ScenarioUse
Linear guided process (sales, onboarding)BPF
Approval routing with multiple approversPower Automate
Complex branching with parallel pathsPower Automate
Simple field validation on stage transitionBPF + Business Rule
Process spans multiple entitiesBPF (cross-entity)
Status tracking without enforcementStatus Reason field

BPF Concepts

Key Terms

TermDescription
StageA phase in the process (e.g., Qualify, Develop)
StepA data field within a stage that should be completed
BranchConditional path based on field values
Cross-entityBPF that spans multiple tables (e.g., Lead → Opportunity → Order)
Active PathThe current set of stages the record is following
Process InstanceThe specific BPF record tracking this entity's progress

BPF Entity

Every BPF creates a hidden system table (e.g., new_bpf_abc123) that stores process instance data. This table has:

  • activestageid — current stage
  • traversedpath — stages visited
  • businessprocessflowinstanceid — unique process instance
  • bpf_[entityname]id — link to the primary record

BPF Management via Web API

List Business Process Flows

http
GET /api/data/v9.2/workflows
  ?$select=name,uniquename,primaryentity,category,statecode,statuscode
  &$filter=category eq 4 and statecode eq 1

Category 4 = Business Process Flow. Statecode 1 = Activated.

Get BPF Stages

http
GET /api/data/v9.2/processstages
  ?$select=stagename,stagecategory,primaryentitytypecode,processstageid
  &$filter=processid/workflowid eq 'bpf-workflow-guid'
  &$orderby=stagecategory asc

Get Active Process Instance for a Record

http
GET /api/data/v9.2/RetrieveActivePath(Target=@target)
  ?@target={'@odata.id':'contoso_projects(record-guid)'}

Move to Next Stage

http
# Get current active stage
GET /api/data/v9.2/new_bpf_projectonboarding
  ?$filter=bpf_contoso_projectid/contoso_projectid eq 'record-guid' and statecode eq 0
  &$select=businessprocessflowinstanceid,activestageid,traversedpath

# Update to next stage
PATCH /api/data/v9.2/new_bpf_projectonboarding(instance-guid)
Content-Type: application/json

{
  "activestageid@odata.bind": "/processstages(next-stage-guid)"
}

Set BPF on a Record

http
# Create process instance
POST /api/data/v9.2/new_bpf_projectonboarding
Content-Type: application/json

{
  "bpf_contoso_projectid@odata.bind": "/contoso_projects(record-guid)",
  "activestageid@odata.bind": "/processstages(first-stage-guid)"
}

Activate / Deactivate BPF Definition

http
# Activate BPF
PATCH /api/data/v9.2/workflows(bpf-workflow-guid)
Content-Type: application/json

{ "statecode": 1, "statuscode": 2 }

# Deactivate BPF
PATCH /api/data/v9.2/workflows(bpf-workflow-guid)
Content-Type: application/json

{ "statecode": 0, "statuscode": 1 }

⚠️ SetState does NOT work for BPFs (category 4). POST /workflows({id})/Microsoft.Dynamics.CRM.SetState returns 404. Use PATCH instead.


BPF Creation via Web API

⚠️ CRITICAL: BPFs Require XAML — clientdata-Only Creation Always Fails

Unlike business rules and cloud flows, BPFs MUST be created with a xaml property. Attempting POST /workflows with category: 4 and clientdata but no xaml returns 0x80040203: workflowstep. The system auto-generates clientdata from the XAML.

Required Properties

http
POST /api/data/v9.2/workflows
Content-Type: application/json
MSCRM.SolutionUniqueName: YourSolution

{
  "name": "Asset Onboarding",
  "category": 4,
  "type": 1,
  "primaryentity": "contoso_asset",
  "scope": 4,
  "statecode": 0,
  "statuscode": 1,
  "xaml": "<Activity x:Class=\"XrmWorkflow...\" ...>[XAML]</Activity>"
}
PropertyValueNotes
category4Business Process Flow
type1Definition
scope4Organization (NOT 1 — scope=1 is rejected for BPFs)
primaryentitylogical nameThe table the BPF applies to
xamlstringREQUIRED — clientdata is auto-generated

⚠️ CRITICAL: BPF XAML Uses ActivityReference Format, Not Simplified Elements

The XAML structure below shows the conceptual hierarchy. The actual API format requires mxswa:ActivityReference elements with AssemblyQualifiedName — not simplified <mcwb:StageComposite> elements.

Reliable discovery method: Query an existing BPF's XAML from the environment and use it as a structural template:

http
GET /api/data/v9.2/workflows?$filter=category eq 4 and statecode eq 1&$select=name,xaml&$top=5

Adapt the discovered XAML (change entity names, stage names, field references). This is more reliable than building XAML from scratch.

Key format differences from simplified documentation:

  • Uses mxswa:ActivityReference with AssemblyQualifiedName for every composite element
  • Requires x:Members block (InputEntities/CreatedEntities) in the Activity header
  • Uses mxswa:Workflow wrapper
  • All properties via sco:Collection with x:Key entries
  • StepLabels with GUIDs required on every step and stage
  • Sequential DisplayName numbering is global across all XAML
  • StageCategory is always "-1" (not 0, 1, 2, 3)
  • Last stage requires <x:Null x:Key="NextStageId" />

XAML Structure

StageRelationshipCollectionComposite
  → EntityComposite (one per stage, even if same entity)
    → StageComposite
      → StepComposite
        → Sequence with mcwb:Control

BPF Step Control ClassIds

TypeClassId
Text4273edbd-ac1d-40d3-9fb2-095c621b552d
Date5b773807-9fb2-42db-97c3-7a91eff8adff
Choice3ef39988-22bb-4f0b-bbbe-64b5a3748aee
Lookup270bd3db-d9af-4782-9025-509e298dec0a
Numberc6d124ca-7eda-4a60-aea9-7fb8d318b68f
Money533b9e00-756b-4312-95a0-dc888637ac78

⚠️ BPF Backing Tables Must Be Added to Solution

Creating a BPF auto-creates a backing table (e.g., contoso_assetonboarding) but the MSCRM.SolutionUniqueName header only adds the workflow — NOT the backing table. Without solution membership + security role privileges, users can see the BPF on forms but cannot advance stages.

The backing table logical name equals the workflow's uniquename property. After creating the BPF:

  1. Add backing table to solution: AddSolutionComponent with ComponentType: 1
  2. Grant security role privileges: Create, Read, Write, Append, AppendTo at Global depth

BPF Client-Side JavaScript

Get Active Process

typescript
// Get the current BPF on the form
const activeProcess = formContext.data.process.getActiveProcess();
if (activeProcess) {
  const processName = activeProcess.getName();
  const processId = activeProcess.getId();
}

Get/Set Active Stage

typescript
// Get current stage
const stage = formContext.data.process.getActiveStage();
const stageName = stage.getName();
const stageId = stage.getId();

// Get stage steps
const steps = stage.getSteps();
steps.forEach((step) => {
  console.log(step.getName(), step.getAttribute(), step.isRequired());
});

// Move to next stage
formContext.data.process.moveNext((result) => {
  if (result === "success") {
    console.log("Moved to next stage");
  } else if (result === "crossEntity") {
    console.log("Process moved to different entity");
  } else if (result === "end") {
    console.log("Process completed");
  } else {
    console.log("Cannot move: incomplete required steps");
  }
});

// Move to previous stage
formContext.data.process.movePrevious((result) => {
  console.log("Move back result:", result);
});

BPF Events

typescript
// Stage change event
formContext.data.process.addOnStageChange((executionContext) => {
  const eventArgs = executionContext.getEventArgs();
  const direction = eventArgs.getDirection(); // "Next" or "Previous"
  const stage = eventArgs.getStage();

  // Prevent stage change based on conditions
  if (direction === "Next" && !isStageComplete(formContext)) {
    eventArgs.preventDefault();
    formContext.ui.setFormNotification(
      "Please complete all required fields before proceeding.",
      "WARNING",
      "stage_incomplete"
    );
  }
});

// Stage selected event (user clicks on a stage header)
formContext.data.process.addOnStageSelected((executionContext) => {
  const stage = executionContext.getEventArgs().getStage();
  console.log("User selected stage:", stage.getName());
});

// Process status change
formContext.data.process.addOnProcessStatusChange((executionContext) => {
  const status = formContext.data.process.getStatus();
  // "active", "aborted", "finished"
  if (status === "finished") {
    formContext.ui.setFormNotification(
      "Process completed successfully!",
      "INFO",
      "process_complete"
    );
  }
});

Set BPF Visibility

typescript
// Show/hide the BPF bar
formContext.ui.process.setVisible(false); // Hide the BPF
formContext.ui.process.setDisplayState("collapsed"); // Collapse
formContext.ui.process.setDisplayState("expanded"); // Expand

BPF with Branching

Branch Conditions

Branches are defined in the BPF designer based on field values:

Stage: Qualification
  ├── If account_type = "Enterprise" → Stage: Enterprise Review
  └── If account_type = "SMB" → Stage: SMB Fast Track

The active path recalculates when the branching field value changes.


Anti-Patterns

  • Using BPF for non-linear processes (use Power Automate instead)
  • Too many stages (>7 becomes unusable, aim for 3-5)
  • Mandatory steps on every stage (frustrates users — use recommended instead)
  • Not handling cross-entity BPF transitions in automation
  • Ignoring the BPF entity table when querying process data
  • Creating BPFs via API without XAML (clientdata-only always fails)
  • Using SetState for activation (returns 404 — use PATCH)
  • Forgetting to add BPF backing tables to the solution
  • Using scope=1 instead of scope=4 for BPFs

Related Skills

  • model-driven-apps — BPFs are consumed in Model-Driven Apps
  • dataverse — Underlying table and relationship design for BPF entities
  • dashboards — Dashboards are a separate skill for visualization
  • dataverse-web-api/business-rules-api — Business rules share the workflow entity but differ in category and creation patterns

常见问题

Business Process Flows AI 技能有什么作用?

业务流程流(BPF)。适用于:创建 BPF、BPF 阶段、BPF 分支、跨实体 BPF、通过 API 创建 BPF XAML、激活 BPF、BPF 客户端 JavaScript,以及流程实例管理。

为什么在 TypingMind 中使用 Business Process Flows?

因为您只需安装一次,就能搭配任何模型使用。Business Process Flows 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Business Process Flows?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/korchard333/claude-power-platform-community/tree/main/.claude/skills/business-process-flows。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Business Process Flows?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Business Process Flows 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Business Process Flows 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Business Process Flows AI 技能免费吗?

是的。korchard333 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇