service-omni-work-skill-routing-configure
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseservice-omni-work-skill-routing-configure
service-omni-work-skill-routing-configure
Author an Omni WorkSkillRouting rule so work is routed to agents by a field value on the work record, not just by skills the agent happens to hold. Where makes an agent routable (Skill + ServiceResource + ServiceResourceSkill), this skill decides which skill a work item requires based on one of its fields — for example "when = , require the skill". The rule is one record (a header plus one mapping) deployed via the Metadata API. It runs after the referenced Skill exists and belongs to the same routing family coordinated by .
service-omni-skills-based-routing-configureCase.OriginPhoneVoiceWorkSkillRoutingworkSkillRoutingAttributesservice-omni-channel-setup-coordinate编写Omni WorkSkillRouting规则,使工作项根据工作记录上的字段值路由至Agent,而非仅依据Agent已拥有的技能。用于让Agent具备可路由性(Skill + ServiceResource + ServiceResourceSkill),而本技能则根据工作项的某个字段确定其所需的技能——例如“当 = 时,要求具备技能”。该规则为一条记录(包含一个头部信息和一个映射),通过Metadata API部署。运行本技能前,需确保引用的Skill已存在,且与协调的同一路由家族关联。
service-omni-skills-based-routing-configureCase.OriginPhoneVoiceWorkSkillRoutingworkSkillRoutingAttributesservice-omni-channel-setup-coordinateInputs
输入参数
bash
bash scripts/configure-and-report.sh <org-alias> <related_entity> <field> <skill> <value> [rule_master_label]- (required).
org-alias - (required). The sObject the rule applies to (e.g.
related_entity,Case,MessagingSession,LiveChatTranscript,Lead).VoiceCall - (required). The field the attribute evaluates (e.g.
fieldorCase.Origin). Bare standard fields are qualified with the related entity before deploy, soOriginbecomesOrigininstead of being misread as a custom-field metadata name.Case.Origin - (required). The Omni
skillDeveloperName required when the field matches (e.g.Skill).Voice - (required). The field value that maps to the skill (e.g.
value). Plain values only; XML-reserved characters are not supported.Phone - (optional). MasterLabel for the rule; defaults to
rule_master_label.<related_entity> Skill Routing
Env overrides: (fullName of the rule, default the related-entity name — one rule per entity), (default ), (0–10), (0–10, additional-skill drop order), (/).
RULE_DEVELOPER_NAMEIS_ACTIVEtrueSKILL_LEVELSKILL_PRIORITYIS_ADDITIONAL_SKILLtruefalsebash
bash scripts/configure-and-report.sh <org-alias> <related_entity> <field> <skill> <value> [rule_master_label]- (必填)。
org-alias - (必填)。规则适用的sObject(例如
related_entity、Case、MessagingSession、LiveChatTranscript、Lead)。VoiceCall - (必填)。属性评估的字段(例如
field或Case.Origin)。部署前,纯标准字段会自动关联实体,因此Origin会转换为Origin,避免被误读为自定义字段元数据名称。Case.Origin - (必填)。字段匹配时所需的Omni
skillDeveloperName(例如Skill)。Voice - (必填)。映射至技能的字段值(例如
value)。仅支持纯文本值;不支持XML保留字符。Phone - (可选)。规则的MasterLabel;默认值为
rule_master_label。<related_entity> Skill Routing
环境变量覆盖:(规则的fullName,默认值为关联实体名称——每个实体对应一条规则)、(默认值)、(0–10)、(0–10,附加技能的排序优先级)、(/)。
RULE_DEVELOPER_NAMEIS_ACTIVEtrueSKILL_LEVELSKILL_PRIORITYIS_ADDITIONAL_SKILLtruefalsePreconditions and safety
前置条件与安全机制
- Target org authenticated via CLI, Service Cloud license,
sfCLI ≥ 2.139.6.sf - Omni-Channel base settings enabled with skills-based routing turned on ().
service-omni-base-settings-configure - The referenced already exists (
Skill).service-omni-skills-based-routing-configure - The three-way production guard applies.
safe_to_write
- 已通过CLI完成目标组织身份验证,拥有Service Cloud许可证,且
sfCLI版本≥2.139.6。sf - 已启用Omni-Channel基础设置,并开启基于技能的路由(可通过配置)。
service-omni-base-settings-configure - 引用的已存在(通过
Skill创建)。service-omni-skills-based-routing-configure - 启用三方生产环境保护机制。
safe_to_write
Run
运行流程
- safe_to_write — query ; refuse to write to a real production org.
Organization - Skill prereq — query by DeveloperName; if absent, block and point at
Skill.service-omni-skills-based-routing-configure - Merge — read the existing through the Tooling API, preserve unrelated attributes, and replace or append only the requested
WorkSkillRouting.Metadatamapping. An inconclusive read blocks the write;(field, value)is the explicit destructive-replacement escape hatch.WSR_REPLACE=1 - Deploy — materialize the merged record (elements in XSD/alphabetical order) and deploy it via the Metadata API (async + poll to a terminal state).
WorkSkillRouting - Classify — read (
files[].state/Created/Changed) to reportUnchanged/created/updated.reused
- 安全写入校验 —— 查询;拒绝写入真实生产环境。
Organization - Skill前置校验 —— 通过DeveloperName查询;若不存在,则阻止操作并引导使用
Skill。service-omni-skills-based-routing-configure - 合并处理 —— 通过Tooling API读取现有,保留无关属性,仅替换或追加请求的
WorkSkillRouting.Metadata映射。若读取结果不明确,则阻止写入;(field, value)为显式破坏性替换的应急开关。WSR_REPLACE=1 - 部署操作 —— 生成合并后的记录(元素按XSD/字母顺序排列),并通过Metadata API部署(异步执行+轮询至终端状态)。
WorkSkillRouting - 状态分类 —— 读取(
files[].state/Created/Changed)以报告Unchanged/created/updated状态。reused
Behavior
行为特性
Idempotent + merge-safe. WorkSkillRouting permits a single rule per related entity, so the rule's fullName defaults to the entity name. Re-running the same mapping reports ; a new mapping is merged into the existing attribute list; changing the same field/value mapping updates only that entry. The skill never silently replaces an existing rule when its current metadata could not be read.
reusedGraceful degradation. WorkSkillRouting is not provisioned on every org (some trials/CDOs). A deploy failure shaped like / "not available" / "WorkSkillRouting" is reported as with a clear limitation message and a pointer to base settings — the skill surfaces the limitation rather than crashing.
INVALID_TYPEblocked幂等性 + 合并安全性。WorkSkillRouting要求每个关联实体对应一条规则,因此规则的fullName默认使用实体名称。重复运行相同映射会报告;新映射会合并至现有属性列表;修改同一字段/值映射仅更新对应条目。当无法读取当前元数据时,本技能绝不会静默替换现有规则。
reused优雅降级。并非所有组织都配置了WorkSkillRouting(部分试用版/CDO组织)。若部署失败提示 / “不可用” / “WorkSkillRouting”,则会报告为状态,并显示清晰的限制信息及基础设置引导链接——本技能会暴露限制而非直接崩溃。
INVALID_TYPEblockedOutput contract
输出约定
A single JSON object: ∈ | | | (plus in plan mode), (), (), (), , , .
statuscreatedupdatedreusedblockedaction_neededrule{developer_name, master_label, related_entity, is_active, state}attribute{field, skill, value, skill_level, skill_priority, is_additional_skill}merge{merged_from_existing, attribute_count, preserved_count}deploy_idmanual_actionsblocking_issue返回单个JSON对象: ∈ | | | (计划模式下附加)、()、()、()、、、。
statuscreatedupdatedreusedblockedaction_neededrule{developer_name, master_label, related_entity, is_active, state}attribute{field, skill, value, skill_level, skill_priority, is_additional_skill}merge{merged_from_existing, attribute_count, preserved_count}deploy_idmanual_actionsblocking_issueLimitations
限制说明
- One field→skill mapping per invocation and one rule per related entity. Multiple invocations safely accumulate attributes on that rule.
- Does not create the Skill, ServiceResources, agent users, queues, or presence configuration.
- Field/value correctness is validated by the platform at deploy time; an invalid field or value surfaces as a deploy failure.
blocked
- 每次调用仅支持一个字段→技能映射,且每个关联实体对应一条规则。多次调用可安全地在该规则上累积属性。
- 不支持创建Skill、ServiceResources、Agent用户、队列或在线状态配置。
- 字段/值的正确性由平台在部署时验证;无效的字段或值会导致部署失败并报告为状态。
blocked
References
参考资料
| File | When to read |
|---|---|
| WorkSkillRouting metadata shape, XSD element order, one-rule-per-entity constraint, attribute fields, and graceful-degradation triggers |
| When validating changes — run |
| 文件 | 阅读场景 |
|---|---|
| 了解WorkSkillRouting元数据结构、XSD元素顺序、单实体单规则约束、属性字段及优雅降级触发条件 |
| 验证变更时——从本技能目录运行 |