@salesforce/afv-skills 1.59.0 → 1.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-architecture-analyze/SKILL.md +66 -17
  3. package/skills/agentforce-architecture-analyze/assets/cli/show_access_token.yaml +4 -7
  4. package/skills/agentforce-architecture-analyze/references/contract.json +1 -1
  5. package/skills/agentforce-architecture-analyze/scripts/emit_env.py +2 -2
  6. package/skills/agentforce-architecture-analyze/scripts/main.py +40 -44
  7. package/skills/agentforce-architecture-analyze/scripts/rest_client.py +11 -3
  8. package/skills/agentforce-architecture-analyze/scripts/sf_cli.py +77 -10
  9. package/skills/agentforce-architecture-analyze/scripts/tests/test_end_to_end_fixture.py +1 -0
  10. package/skills/agentforce-architecture-analyze/scripts/tests/test_flow_children_inflation.py +1 -0
  11. package/skills/agentforce-architecture-analyze/scripts/tests/test_main_pipeline.py +53 -2
  12. package/skills/agentforce-architecture-analyze/scripts/tests/test_resolve_creds.py +184 -36
  13. package/skills/agentforce-architecture-analyze/scripts/tests/test_rest_client.py +17 -0
  14. package/skills/agentforce-architecture-analyze/scripts/tests/test_sf_cli.py +165 -11
  15. package/skills/agentforce-architecture-analyze/scripts/tests/test_skill_md_pipeline_block.py +319 -0
  16. package/skills/agentforce-d360-analyze/SKILL.md +28 -10
  17. package/skills/agentforce-d360-analyze/scripts/dc.py +200 -50
  18. package/skills/agentforce-d360-analyze/scripts/discover_sessions.py +10 -6
  19. package/skills/agentforce-d360-analyze/scripts/fetch_dc.py +22 -6
  20. package/skills/agentforce-d360-analyze/scripts/resolve_session.py +21 -13
  21. package/skills/agentforce-d360-analyze/scripts/tests/test_dc_and_resolve_session.py +298 -76
  22. package/skills/agentforce-d360-analyze/scripts/tests/test_default_target_org.py +432 -0
  23. package/skills/agentforce-d360-analyze/scripts/tests/test_discover_sessions.py +1 -1
  24. package/skills/agentforce-d360-analyze/scripts/tests/test_resolve_session_main.py +9 -3
  25. package/skills/agentforce-d360-analyze/scripts/tests/test_skill_md_prefix_block.py +176 -0
  26. package/skills/consumer-goods-accruals-datakit-deploy/SKILL.md +17 -27
  27. package/skills/consumer-goods-accruals-datakit-deploy/scripts/setup.js +7 -17
  28. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/00-check-prerequisites.js +47 -63
  29. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/01-download-static-resource.js +10 -13
  30. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/02-replace-org-id.js +46 -46
  31. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/03-deploy-metadata.js +4 -21
  32. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/06-create-dataspace.js +58 -82
  33. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/07-deploy-accruals-reports.js +16 -315
  34. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/08-deploy-ui.js +9 -24
  35. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/09-completion.js +44 -44
  36. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/utils.js +11 -63
  37. package/skills/consumer-goods-rtr-datacloud-export-configure/SKILL.md +2 -1
  38. package/skills/consumer-goods-tpe-dashboard-configure/SKILL.md +2 -1
  39. package/skills/consumer-goods-tpe-dashboard-custom-kpi-configure/SKILL.md +2 -1
  40. package/skills/consumer-goods-tpe-datakit-deploy/SKILL.md +2 -1
  41. package/skills/data360-schema-get/SKILL.md +3 -3
  42. package/skills/design-systems-slds-validate/references/report-format.md +1 -1
  43. package/skills/dx-org-manage/SKILL.md +1 -0
  44. package/skills/dx-org-shape-manage/SKILL.md +1 -0
  45. package/skills/dx-org-snapshot-manage/SKILL.md +172 -0
  46. package/skills/dx-org-snapshot-manage/examples/create_error_output.json +16 -0
  47. package/skills/dx-org-snapshot-manage/examples/create_success_output.json +19 -0
  48. package/skills/dx-org-snapshot-manage/examples/delete_output.json +9 -0
  49. package/skills/dx-org-snapshot-manage/examples/get_output.json +19 -0
  50. package/skills/dx-org-snapshot-manage/examples/list_output.json +36 -0
  51. package/skills/dx-org-snapshot-manage/references/cli_flags.md +179 -0
  52. package/skills/dx-org-snapshot-manage/references/snapshot_usage.md +55 -0
  53. package/skills/dx-org-trial-expiration-check/SKILL.md +1 -1
  54. package/skills/dx-org-trial-expiration-check/scripts/check_expiration.sh +2 -2
  55. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +7 -5
  56. package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +11 -11
  57. package/skills/experience-content-media-image-generate/SKILL.md +83 -0
  58. package/skills/experience-content-media-image-generate/scripts/download-image.sh +84 -0
  59. package/skills/external-diagram-mermaid-generate/SKILL.md +12 -12
  60. package/skills/field-service-data-capture-migrate/references/component-mapping.md +1 -1
  61. package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +1 -2
  62. package/skills/field-service-data-capture-migrate/references/known-deploy-errors.md +1 -0
  63. package/skills/field-service-data-capture-migrate/references/transformer-rules.md +1 -1
  64. package/skills/field-service-data-capture-migrate/scripts/transform_flow.py +12 -1
  65. package/skills/field-service-data-capture-migrate/scripts/vendor/build_flow.py +4 -1
  66. package/skills/field-service-setup-orchestrator-get/SKILL.md +0 -1
  67. package/skills/insurance-brokerage-agency-billing-configure/SKILL.md +233 -0
  68. package/skills/insurance-brokerage-agency-billing-configure/references/accounting-setup.md +117 -0
  69. package/skills/insurance-brokerage-agency-billing-configure/references/billing-rules-config.md +237 -0
  70. package/skills/insurance-brokerage-agency-billing-configure/references/billing-settings.md +271 -0
  71. package/skills/insurance-brokerage-agency-billing-configure/references/demo-policy-config.md +138 -0
  72. package/skills/insurance-brokerage-agency-billing-configure/references/org-defaults.md +64 -0
  73. package/skills/insurance-brokerage-agency-billing-configure/references/permissions-config.md +226 -0
  74. package/skills/insurance-brokerage-agency-billing-configure/references/prerequisites.md +142 -0
  75. package/skills/life-sciences-fieldsalesrep-coordinate/SKILL.md +3 -2
  76. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-execution-state-and-recovery.md +3 -3
  77. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-overview.md +68 -45
  78. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-visit-creation-data.md +17 -18
  79. package/skills/life-sciences-kam-coordinate/references/stage-5-data-and-plan-templates-overview.md +16 -3
  80. package/skills/life-sciences-kam-coordinate/references/stage-5-data-creation-data.md +16 -13
  81. package/skills/marketing-message-test/SKILL.md +194 -0
  82. package/skills/marketing-message-test/references/api-contract.md +333 -0
  83. package/skills/omnistudio-callable-apex-generate/SKILL.md +3 -3
  84. package/skills/omnistudio-datamapper-generate/SKILL.md +6 -6
  85. package/skills/omnistudio-datapacks-deploy/SKILL.md +11 -11
  86. package/skills/omnistudio-dependencies-analyze/SKILL.md +5 -5
  87. package/skills/omnistudio-epc-catalog-generate/SKILL.md +6 -6
  88. package/skills/omnistudio-flexcard-generate/SKILL.md +6 -6
  89. package/skills/omnistudio-integration-procedure-generate/SKILL.md +6 -6
  90. package/skills/omnistudio-omniscript-generate/SKILL.md +6 -5
  91. package/skills/platform-apex-logs-debug/SKILL.md +1 -0
  92. package/skills/platform-metadata-deploy/SKILL.md +1 -0
  93. package/skills/platform-models-api-configure/SKILL.md +5 -5
  94. package/skills/platform-soql-query/SKILL.md +1 -0
  95. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +17 -6
  96. package/skills/service-itsm-agentic-setup-incident-sla-configure/SKILL.md +107 -192
  97. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/attach-milestone-action.json +6 -6
  98. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/milestone-patterns.md +49 -20
  99. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/output-templates.md +4 -4
  100. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/mcp-invocation.md +224 -290
  101. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/workflow.md +295 -0
  102. package/skills/service-itsm-incident-priority-configure/SKILL.md +1 -1
  103. package/skills/service-itsm-slack-itservice-configure/SKILL.md +2 -1
  104. package/skills/service-itsm-slack-itservice-configure/references/manage-slack-connection.md +2 -2
  105. package/skills/service-omni-channel-setup-coordinate/SKILL.md +20 -13
  106. package/skills/service-omni-channel-setup-coordinate/scripts/integration-driver.sh +5 -55
  107. package/skills/service-omni-channel-setup-coordinate/scripts/tests/test_omni_contracts.py +0 -38
  108. package/skills/service-omni-command-center-analyze/SKILL.md +2 -3
  109. package/skills/service-omni-command-center-analyze/scripts/analyze.sh +3 -3
  110. package/skills/tableau-next-asset-create/README.md +65 -0
  111. package/skills/tableau-next-asset-create/SKILL.md +409 -0
  112. package/skills/tableau-next-asset-create/references/admin-users.md +149 -0
  113. package/skills/tableau-next-asset-create/references/ai-readiness.md +355 -0
  114. package/skills/tableau-next-asset-create/references/alerts.md +111 -0
  115. package/skills/tableau-next-asset-create/references/build-workflow.md +819 -0
  116. package/skills/tableau-next-asset-create/references/dashboard-authoring.md +302 -0
  117. package/skills/tableau-next-asset-create/references/dashboard-design-principles.md +352 -0
  118. package/skills/tableau-next-asset-create/references/data-transform-gotchas.md +210 -0
  119. package/skills/tableau-next-asset-create/references/data-understanding.md +387 -0
  120. package/skills/tableau-next-asset-create/references/deep-reference-index.md +74 -0
  121. package/skills/tableau-next-asset-create/references/destructive-operations.md +62 -0
  122. package/skills/tableau-next-asset-create/references/edit-dashboard.md +273 -0
  123. package/skills/tableau-next-asset-create/references/edit-visualization.md +529 -0
  124. package/skills/tableau-next-asset-create/references/empty-source-handling.md +104 -0
  125. package/skills/tableau-next-asset-create/references/ingest-and-metric-gotchas.md +638 -0
  126. package/skills/tableau-next-asset-create/references/insight-bundle.md +69 -0
  127. package/skills/tableau-next-asset-create/references/large-flat-file-handling.md +331 -0
  128. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/_envelope.json +54 -0
  129. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/_shared-widget-fields.json +122 -0
  130. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/add_page.json +29 -0
  131. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/delete_page.json +27 -0
  132. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/discard_dashboard.json +11 -0
  133. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/move_widget.json +30 -0
  134. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/move_widget_to_page.json +30 -0
  135. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/place_widget_on_page.json +30 -0
  136. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/remove_widget_from_dashboard.json +16 -0
  137. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/remove_widget_from_page.json +26 -0
  138. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/rename_page.json +28 -0
  139. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/save_dashboard.json +18 -0
  140. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/undo.json +11 -0
  141. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_button_widget.json +69 -0
  142. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_container_widget.json +88 -0
  143. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_filter_widget.json +146 -0
  144. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_metric_widget.json +78 -0
  145. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_navigation_widget.json +80 -0
  146. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_parameter_widget.json +160 -0
  147. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_text_widget.json +103 -0
  148. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_visualization_widget.json +68 -0
  149. package/skills/tableau-next-asset-create/references/sdm-tool-reference.md +721 -0
  150. package/skills/tableau-next-asset-create/references/semantic-query-and-enrichment.md +355 -0
  151. package/skills/tableau-next-asset-create/references/shared-gates.md +322 -0
  152. package/skills/tableau-next-asset-create/references/sharing-and-promotion.md +306 -0
  153. package/skills/tableau-next-asset-create/references/tasks/ai-readiness-audit.md +51 -0
  154. package/skills/tableau-next-asset-create/references/tasks/analyze-data.md +48 -0
  155. package/skills/tableau-next-asset-create/references/tasks/build-dashboard.md +66 -0
  156. package/skills/tableau-next-asset-create/references/tasks/build-end-to-end.md +73 -0
  157. package/skills/tableau-next-asset-create/references/tasks/create-data-transform.md +51 -0
  158. package/skills/tableau-next-asset-create/references/tasks/create-viz.md +58 -0
  159. package/skills/tableau-next-asset-create/references/tasks/edit-dashboard.md +80 -0
  160. package/skills/tableau-next-asset-create/references/tasks/edit-sdm.md +106 -0
  161. package/skills/tableau-next-asset-create/references/tasks/edit-viz.md +40 -0
  162. package/skills/tableau-next-asset-create/references/tasks/enrich-model.md +68 -0
  163. package/skills/tableau-next-asset-create/references/tasks/ingest-flat-file.md +68 -0
  164. package/skills/tableau-next-asset-create/references/tasks/manage-alert.md +35 -0
  165. package/skills/tableau-next-asset-create/references/tasks/profile-dataset.md +47 -0
  166. package/skills/tableau-next-asset-create/references/tasks/promote-or-reuse.md +46 -0
  167. package/skills/tableau-next-asset-create/references/tasks/provision-user.md +39 -0
  168. package/skills/tableau-next-asset-create/references/tasks/query-model.md +92 -0
  169. package/skills/tableau-next-asset-create/references/tasks/review-verified-questions.md +42 -0
  170. package/skills/tableau-next-asset-create/references/tasks/share-asset.md +37 -0
  171. package/skills/tableau-next-asset-create/references/verified-questions.md +125 -0
  172. package/skills/tableau-next-asset-create/references/viz-authoring.md +992 -0
  173. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/predefined-incident-policy.json +0 -102
@@ -18,7 +18,8 @@ metadata:
18
18
  tools: ["describe", "discover", "dispatch", "dispatch_readonly"]
19
19
  semver: ">=1.0.0"
20
20
  allowed-tools: |
21
- Read AskUserQuestion
21
+ Read
22
+ AskUserQuestion
22
23
  mcp__headless-360__discover
23
24
  mcp__headless-360__describe
24
25
  mcp__headless-360__dispatch
@@ -31,13 +32,28 @@ Configures a complete **Incident SLA pipeline** for Service Cloud ITSM — the c
31
32
  EntityMilestone (with a computed TargetDate) on every Incident with an Entitlement, all via the
32
33
  Salesforce-hosted **`headless-360`** MCP server (org from the OAuth JWT). Requires the org-level
33
34
  **SLA Management for IT Service** setup item (the Phase 0.5 gate).
34
- Four parts: **MilestoneType** (what you measure) → **SLA Policy** (SlaProcess, Incident-scoped,
35
- entry/exit criteria) → **Milestone** (time trigger + criteria) → **Entitlement** (Account-wired, so
36
- Incidents engage the SLA).
35
+ The custom pipeline (four ordered writes): **MilestoneType** (what you measure) → **SLA Policy**
36
+ (SlaProcess, Incident-scoped, created inactive, entry/exit criteria) → **Milestone** (time trigger +
37
+ criteria) → **activate the policy** (`createEntitlement=true`, which auto-provisions the Entitlement —
38
+ matching Incidents then engage the SLA **per-Incident via `EntitlementId`**, with no Account). An
39
+ org-wide auto-apply **entitlement criterion** is an *optional* fifth write, dispatched **only** on an
40
+ explicit always-match request (Phase 2 step 12) — never by default. (The predefined/OOB
41
+ seed fork differs — it does none of this by hand: a single seed call provisions the whole active
42
+ bundle — policy, milestones, and Entitlement — in one shot; see Phase 0.6 / Phase 2-OOB.)
43
+ This skill owns all the Incident-SLA **interaction** (gates, forks, milestone strategy,
44
+ verification); the raw **write** operations are **delegated to the approved CSP-Sun SLA
45
+ leaf capabilities** (`csp-sun/MilestoneTypes`, `create-sla-policy`, `create-milestone`,
46
+ `create-milestone-action`, `activate-sla-policy`, `create-entitlement-criteria`), which own the
47
+ approved Connect contracts — discover → describe → dispatch each rather than re-deriving its shape here.
48
+ The Phase 0.5 **enable** (+ Versioning) and Phase 2-OOB **seed** writes delegate to
49
+ **`itsm-shakti/SLASettings`** (owns the SLA-Management settings surface) — same discover → describe → dispatch.
37
50
 
38
51
  ## Scope
39
52
 
40
- - **In scope**: the four artifacts above + verifying SLA engagement on Incident records; gating
53
+ - **In scope**: the SLA artifacts above (MilestoneTypes, the SLA Policy and its milestones,
54
+ activation with its auto-provisioned Entitlement, and — only on an explicit org-wide always-match
55
+ request — the optional auto-apply criterion) + verifying SLA
56
+ engagement on Incident records; gating
41
57
  **SLA Management for IT Service** (Phase 0.5); offering the OOB *Standard Support for Incidents*
42
58
  policy vs a custom one (Phase 0.6, Incident only) — all via `headless-360` MCP.
43
59
  - **Out of scope**: Case SLA/entitlements; Assignment Rules; Escalation Rules; Notification
@@ -47,11 +63,14 @@ Incidents engage the SLA).
47
63
 
48
64
  ## Output contract — applies to EVERY message
49
65
 
50
- **Never print a raw Salesforce record Id** (15/18-char: `55…`, `550…`, `0ny…`, `00…`) — full **or
66
+ **Never print a raw Salesforce record Id** (15/18-char: `55…`, `550…`, `0ny…`, `00…`, Account `001…`) — full **or
51
67
  masked** (`557VW…R3XVYA0` still leaks) — in **any** user-facing text: interim narration *and* the
52
68
  final report. Holds for artifacts you **created** *and* ones you **detected/reused** — name each (the
53
69
  name you supplied on create, or matched on reuse), keep its Id internal (chaining only). Verifying or
54
- matching via SOQL? Report the **verified attributes/name**, never the Id you queried by. One
70
+ matching via SOQL? Report the **verified attributes/name**, never the Id you queried by. **Looking *up*
71
+ an Id is the same rule** — resolving the default **BusinessHours** or an existing policy returns
72
+ `{Id, Name}`; narrate the resolved **name only** and keep the returned Id internal — **never** echo it
73
+ back as `Resolved "<name>" (001VW…)`. One
55
74
  exception: on a **halt** you may relay the raw error body verbatim even if it embeds an Id —
56
75
  don't hand-edit it.
57
76
 
@@ -74,186 +93,80 @@ from `{status_code, body}`. Full route table with request/response shapes: `refe
74
93
 
75
94
  Ask only what you cannot infer from context (pre-populate; note "(from conversation)"). **Resolve the
76
95
  Phase 0.5 gate first.** Then: **which org?** (`headless-360` binds to the current OAuth session —
77
- confirm before mutating); **milestone strategy?** (Phase 1.4); **target Account?** (for the
78
- Entitlement); **milestone criteria?** (default `Status != Closed` + pattern-specific filters).
96
+ confirm before mutating); **milestone strategy?** (Phase 1.4); **milestone criteria?** (default
97
+ `Status != Closed` + pattern-specific filters). **Do not ask for an Account** — Incident has no
98
+ Account field; engagement is per-Incident via `EntitlementId`.
79
99
 
80
- Default suggestion: SLA Policy `Incident SLA Policy`, default BusinessHours, the Account the user
81
- picks, Entitlement `today → today + 1 year`, milestone strategy resolved per Phase 1.4.
100
+ Default suggestion: SLA Policy `Incident SLA Policy`, default BusinessHours, Entitlement
101
+ auto-provisioned on activation (no Account), engagement per-Incident via `EntitlementId`, milestone
102
+ strategy resolved per Phase 1.4.
82
103
 
83
104
  ---
84
105
 
85
106
  ## Workflow
86
107
 
87
- All steps are sequential. **Always read before you write.** Every call goes through
88
- `mcp__headless-360__*` tools.
89
-
90
- ### Phase 0 — Reuse what the session already knows
91
-
92
- Each Phase 1 read carries a **skip-if-already-known** clause: skip only when the same fact was
93
- produced **this session** by a successful `dispatch_readonly` on the current org and unwritten since —
94
- a user statement is never cache-eligible. Cacheable: master Incident Mgmt pref (step 1, only if
95
- `ENABLED`), SLA feature + Versioning (Phase 0.5), Incident describe (3), `BusinessHoursId` (4), Account
96
- id (5), SLA Connect ops (2). **When in doubt, re-check.**
97
-
98
- ### Phase 0.5 — SLA Management for IT Service prerequisite gate
99
-
100
- **Resolve this gate first, on its own. Reads are safe up front; confirm the org before any write.**
101
- "SLA Management for IT Service" is enabled only when **both** Simplified SLA Setup (feature
102
- `service-cloud-itsm-manage-sla-policies`) **and** SLA Versioning
103
- (`EntitlementSettings.IsEntitlementVersioningEnabled`) are on; either off → not enabled. The one
104
- feature-`enable` turns on both, **permanently** enabling versioning — inseparable. Shapes /
105
- `enableBlockedReasons` / ack wording: `references/mcp-invocation.md`.
106
-
107
- - **Read both** (`dispatch_readonly`); proceed to Phase 0.6 **only when both are on**.
108
- - **On an OFF org, read the master license first** (Phase 1 step 1, `service-cloud-itsm-incident`):
109
- `NOT_AVAILABLE` → **HALT** — don't flip the permanent Versioning switch where Incident SLA can't run.
110
- - **Two separate `AskUserQuestion` acks — never merge.** (a) master Incident Mgmt `NOT_ENABLED` → ask
111
- to enable it first (reversible, no permanence warning). (b) a *distinct* permanence ack: enabling
112
- **SLA Management** turns on **SLA Versioning**, which **can't be turned off** (the feature disables
113
- later but Versioning stays on). Offer **enable**/**stop** — no "versioning-off"; a bare "enable SLA"
114
- is **not** consent.
115
- - **Decline (b), non-empty `enableBlockedReasons`, or a re-read mismatch → HALT** — enable no SLA
116
- Mgmt/Versioning, don't proceed to Phase 0.6/1 (a reversible master enable from (a) stands). **After
117
- any write, re-read both and report the REAL state** — never trust `201`/`204`.
118
-
119
- ### Phase 0.6 — Predefined (OOB) vs Custom
120
-
121
- Once the gate passes, offer the OOB policy **before** any custom-flow questions. **Incident only.**
122
-
123
- 1. **Prerequisite + detect.** Confirm master Incident Mgmt pref `ENABLED` (Phase 1 step 1). Then `dispatch_readonly` `GET /connect/sla-management/sla-policies` with
124
- `query_params.processTypes=Incident`; match display name **"Standard Support for Incidents"**.
125
- - **Already present** → **no re-seed** (no idempotency), no custom upsell; report it is seeded.
126
- **If warn/escalate actions were requested → resolve the named existing milestones → Phase 2.5 →
127
- Phase 3 verify → STOP** (attach actions even though the policy was already seeded).
128
- 2. **Fork** — one `AskUserQuestion`, **Predefined first / recommended**: Salesforce's predefined
129
- Incident policy (*Standard Support for Incidents* — priority-tiered) **or** a custom one. One-way:
130
- predefined seeds an **active** policy + Entitlement, no un-seed path (manual delete only).
131
- - **Predefined →** resolve BusinessHours + Account (Phase 1 steps 4–5) → **Phase 2-OOB** → **Phase
132
- 2.5** (if actions requested) → Phase 3 verify → **STOP**.
133
- - **Custom →** existing Phase 1 → 1.4 → 1.5 → 2 → 3, unchanged.
134
-
135
- ### Phase 1 — Preflight & discovery
136
-
137
- **On any `401` / `403` / `404` from a step below, halt and surface the raw error** — the org/client is misconfigured. `401` → MCP auth (ECA/token). `403` → user perm OR ITSM Incident Management license/pref missing. `404` → `headless-360` not activated OR Entitlement Management not enabled for Incident.
138
-
139
- 1. **Master Incident Management pref — direct read** *(skip conditions in Phase 0)*.
140
- `dispatch_readonly` `GET .../connect/setup/discovery/features`, filter `features[]` to the **exact**
141
- `apiName == "service-cloud-itsm-incident"` — never a look-alike (`service-cloud-incident-management`
142
- is generic Case-based Incident Management, not our target). Read `status`: `ENABLED` → proceed;
143
- `NOT_AVAILABLE` (license missing) → **halt and surface it** — cannot be enabled here, no delegate/ack;
144
- `NOT_ENABLED` → **explicit `AskUserQuestion` ack first (never auto-enable as an implied SLA
145
- dependency)**, then delegate to `service-itsm-incident-mgmt-configure` inline (confirms-to-write) and
146
- re-read; if declined, halt — every SLA artifact below depends on the master being on. Full shape + why
147
- setup-org-preferences 404s here: `references/mcp-invocation.md` (Preflight A).
148
- 2. **Discover the Connect operations** — *(skip if already verified this session — see Phase 0)*.
149
- `mcp__headless-360__discover(query="sla-management milestone")` to confirm the SLA Management
150
- Connect API is indexed, then `mcp__headless-360__describe(id=<operation_id>)`
151
- for the `milestone-types`, `sla-policies`, and `sla-policies/{id}/milestones` POST operations to pull
152
- their exact input schemas + HTTP routes. If `discover` returns nothing after rewording the query,
153
- the corpus does not index this surface for the org — direct the user to **Setup → SLA/Entitlement
154
- setup** and stop.
155
- 3. **Verify Incident Management + SLA fields** — *(skip if `Incident.describe` result for the
156
- current org is already in context — see Phase 0)*. Otherwise `dispatch_readonly` on
157
- `GET /services/data/v67.0/sobjects/Incident/describe` and confirm `fields[]` includes
158
- `EntitlementId`, `SlaStartDate`, `SlaExitDate`. If the describe 404s or fields are missing, direct
159
- the user to enable Entitlement Management for Incident and stop.
160
- 4. **Find default BusinessHours** — *(skip if `BusinessHoursId` for the current org's default is
161
- already captured this session)*. Otherwise `dispatch_readonly` on `GET /services/data/v67.0/query` with
162
- `query_params.q="SELECT Id, Name FROM BusinessHours WHERE IsActive = true AND IsDefault = true"`.
163
- If `body.records` is empty, stop with a message to create default Business Hours in Setup. Capture
164
- `BusinessHoursId`.
165
- 5. **Resolve the target Account** — *(skip if already resolved this session)*. Phase 2's Entitlement
166
- needs an `AccountId`. If the user **named** one → look up (`SELECT Id, Name FROM Account WHERE Name
167
- = '<escaped>' LIMIT 1`); not found → **stop and ask**, never substitute. If the user **authorized
168
- any/existing Account** → pick the most recently active (`... WHERE IsDeleted = false ORDER BY
169
- LastModifiedDate DESC LIMIT 1`) and **surface which** in the plan. Otherwise → **ask via
170
- `AskUserQuestion`**: list real candidates by **name only** + "type a name"; **never auto-pick,
171
- pre-select, or expose an internal sort key** (e.g. recency). If none exists, stop. Capture `AccountId` + name.
172
- 6. **Read existing SLA artifacts (idempotency probe)** — `dispatch_readonly` SOQL for `SlaProcess` by
173
- name (`... WHERE Name = '<name>' AND SobjectType = 'Incident'` — the field is `SobjectType`;
174
- `ProcessType` returns `INVALID_FIELD`), each `MilestoneType` the strategy would create,
175
- `SlaMilestone` under the matched policy, and `Entitlement` by name on the resolved Account. If
176
- **every** artifact already exists with the requested config, set `noOp=true` and skip Phase 1.4 +
177
- Phase 2 (skip condition (b)); any missing/divergent artifact → proceed to Phase 1.4.
178
-
179
- ### Phase 1.4 — Milestone Strategy
180
-
181
- Every SLA policy needs at least one milestone. Load `examples/milestone-patterns.md` — it lists the
182
- skip conditions (concrete shape in prompt / idempotent no-op / explicit up-front authorization) and
183
- the five strategy options with their `AskUserQuestion` prompt, defaults, and MilestoneType-reuse
184
- rules. Skip condition (c) still requires Phase 1.5 plan-narration before dispatch. Multi-milestone
185
- selection expands to N creates in Phase 2 step 10 (one POST per milestone, `order` 1..N, same SlaProcess).
186
-
187
- ### Phase 1.5 — Confirm before mutating
188
-
189
- 7. **Confirm the plan** — present the resolved config (target **org**, **SLA Policy** name, resolved
190
- **Account** name, **Entitlement** date range, and the **full per-milestone list** — never collapse
191
- Priority-tiered / Custom to "N milestones"). **Skip the `AskUserQuestion`** (but still narrate the
192
- plan before dispatch) when up-front authorization was granted (note `(authorized in prompt)`), the
193
- branch is a no-op, or it was already confirmed in conversation (note `(confirmed in conversation)`);
194
- otherwise require an explicit "yes" before Phase 2. Everything after this step mutates the org.
195
-
196
- ### Phase 2 — Create SLA Artifacts (exact order — each depends on the previous)
197
-
198
- Capture each returned `id` for chaining only.
199
-
200
- 8. **Create MilestoneType(s)** — `POST /connect/sla-management/milestone-types`. One POST per
201
- distinct MilestoneType required by the strategy. Reuse a single MilestoneType across milestones
202
- that share a name (Priority-tiered "First Response" reuses one MilestoneType across all four
203
- milestones); create separate MilestoneTypes for distinct concerns (Response + Resolution =
204
- two MilestoneTypes; Escalation ladder = three). Capture each `id`. A feature enable pre-seeds a
205
- default MilestoneType catalog; a detected/reused one is narrated by name only (Output contract:
206
- name, never `→ <Id>`).
207
- 9. **Create SLA Policy** — `POST /connect/sla-management/sla-policies` with `processType='Incident'`
208
- and the `businessHourId` from Phase 1. Capture `id`. **The response echoes nulls — verify via
209
- SOQL, not the body; narrate the policy by name, never the Id** (Output contract).
210
- 10. **Attach Milestone(s)** — load the request-body template from `assets/attach-milestone.json`
211
- and, for each milestone in the strategy, populate `milestoneTypeId`, `timeTrigger`, `order`
212
- (1..N in the strategy's order) and any per-pattern `filterItems` additions from
213
- `examples/milestone-patterns.md`, then `POST /connect/sla-management/sla-policies/<slaId>/milestones`.
214
- Each `milestoneCriteria[]` item needs `milestoneAgreementType` (`SLA`/`OLA`) and
215
- `filterType: RuleFilter`. Do **not** put `slaProcessId` in the body — carried by the path.
216
- One POST per milestone; on any failure, halt and surface the raw error (no half-attached policy) —
217
- narrate each by `MilestoneType` name, never its Id/`triggerId` (Output contract).
218
- 11. **Create Entitlement** — `POST /sobjects/Entitlement` linking the resolved Account (from Phase 1
219
- step 5), the SLA Policy (`SlaProcessId`), and Business Hours. For immediate engagement, backdate
220
- `StartDate` to yesterday — narrate it by name/Account, never its Id (Output contract).
221
-
222
- ### Phase 2-OOB — Seed the Predefined Incident Policy
223
-
224
- Reached only from Phase 0.6 Predefined (replaces Phase 1.4/1.5/2). Follow the seed recipe in
225
- `references/mcp-invocation.md` (**Predefined Incident Policy**) with `assets/predefined-incident-policy.json`
226
- — it uses the **Phase 2 routes** (2 MilestoneTypes → SLA Policy `active:true` → 6 milestones,
227
- each `startTimeBasedOn: MILESTONE_CRITERIA` → Entitlement), validates each `Priority`/`Status`
228
- against the live picklist, and avoids the Connect activate PATCH. Then Phase 2.5 (if actions requested), Phase 3 (a non-lowest tier — Moderate/Low, not Critical),
229
- and **STOP** — no *proactive* custom offer.
230
-
231
- ### Phase 2.5 — Milestone Actions (optional: Warn / Escalate)
232
-
233
- After milestones exist (Phase 2 or 2-OOB), **only if** the user asked to warn/escalate/notify: apply
234
- the requested checkpoint(s) to **every milestone the user named** (not just one), each offset computed
235
- from that milestone's own target. Map "warn at X%" → an offset *before* target, "on breach" →
236
- *at/after* it; **confirm the full set before writing** (up-front auth waives the re-ask; narrate it
237
- regardless — no headless delete), then, per milestone, delegate to headless
238
- **`create-milestone-action`** (`discover` → `describe` → `dispatch`). **Confirm each from the response
239
- body** (`success` + non-empty `actionMappings`; a *timed* checkpoint also returns a `triggerId`), never
240
- the `201`. Narrate each by its **`MilestoneType` name**, never the milestone Id/`triggerId` (Output
241
- contract). Formula, roles, proven body, defaults, IST business-hours note:
242
- `references/mcp-invocation.md` (Milestone Actions).
243
-
244
- ### Phase 3 — Verify
245
-
246
- 12. **Verify the SLA Policy** — SOQL on `SlaProcess` (do not trust the create response).
247
- 13. **Create a test Incident** with `EntitlementId` set. For Priority-tiered / OOB strategies, test a
248
- tier **other than the lowest `order`** — Critical is order-1, the collapse fallback, so it can't
249
- detect a dropped criterion. If a direct `Priority`
250
- insert is rejected (it may be matrix-derived), set `Urgency`/`Impact` to derive the tier. Narrate
251
- by `IncidentNumber`, never the Id.
252
- 14. **Verify engagement + tiering** — SOQL that `Incident.SlaStartDate` is populated and the
253
- `EntityMilestone` lands on the **correct tier** (a Moderate/Low Incident → the 240/960 tier, NOT
254
- 30/120). The create `201` always echoes `milestoneCriteria:[]`; only this runtime read proves the
255
- ACTIVE criteria persisted.
256
- 15. **Report results** using the output format below.
108
+ All steps are sequential — **always read before you write**; every call goes through
109
+ `mcp__headless-360__*`. **The full step-by-step detail — every phase's reads, delegated writes, and
110
+ API quirks — lives in `references/workflow.md`; read it before executing.** The phases and their
111
+ non-negotiable gates (constraints table + verification checklist below):
112
+
113
+ - **Phase 0 — Reuse session state.** Skip a Phase 1 read only when the same fact was produced *this
114
+ session* by a successful `dispatch_readonly` on the current org and unwritten since; a user
115
+ statement is never cache-eligible. When in doubt, re-check.
116
+ - **Phase 0.5 — SLA Management gate (resolve first, alone).** Enabled only when **both** SLA
117
+ Management and SLA Versioning are on — **two separate writes**: enabling SLA Management does **not**
118
+ turn on Versioning; Versioning is a distinct, **permanent, one-way** write. **Two separate
119
+ `AskUserQuestion` acks — never merged:** (a) a reversible master Incident-Mgmt enable if
120
+ `NOT_ENABLED`; (b) a distinct **permanence** ack for the irreversible Versioning switch — a bare
121
+ "enable SLA" is **not** consent. Decline (b) / non-empty `enableBlockedReasons` / re-read mismatch /
122
+ master `NOT_AVAILABLE` → **HALT**. After each write, re-read and report the REAL state — never trust
123
+ `200`/`204`. Enable + versioning writes **delegate to `itsm-shakti/SLASettings`**.
124
+ - **Phase 0.6 — Predefined (OOB) vs Custom (Incident only).** Detect *Standard Support for Incidents*
125
+ first (already present → report seeded; no re-seed — the OOB seed isn't idempotent — and no
126
+ upsell). **Before** the fork prompt, read the live `Incident.Priority` picklist (Phase 1 step 3's
127
+ Incident describe, pulled forward): any custom active
128
+ value beyond the four standard tiers (e.g. `Emergency`) means OOB covers standard tiers only — say
129
+ so plainly and **redirect to Custom** by default; don't *proactively* bolt a custom milestone onto
130
+ the predefined policy (and never re-seed). Attach one only if the user **explicitly** asks — a direct
131
+ `csp-sun/create-milestone` against the seeded policy (resolved by name), never a re-seed.
132
+ Then one `AskUserQuestion`, **Predefined first/recommended**. Predefined → Phase 2-OOB → 2.5 →
133
+ verify → **STOP**; Custom → Phase 1 → 1.4 → 1.5 → 2 → 3.
134
+ - **Phase 1 — Preflight & discovery.** Master Incident-Mgmt pref (exact `service-cloud-itsm-incident`,
135
+ never a look-alike; `NOT_AVAILABLE` → HALT, `NOT_ENABLED` → ack + delegate), `discover`/`describe`
136
+ the SLA Connect ops, Incident describe (`EntitlementId`/`SlaStartDate`/`SlaExitDate` **+ the live
137
+ `Incident.Priority` picklist** for Priority-tiered reconciliation), default BusinessHours,
138
+ idempotency probe. **No Account is resolved — Incident has no Account field; engagement is
139
+ per-Incident via `EntitlementId` (neither flow needs or asks for an Account).** Any
140
+ `401`/`403`/`404` → halt and surface the raw error.
141
+ - **Phase 1.4 — Milestone strategy.** Load `examples/milestone-patterns.md` (skip conditions + the
142
+ five strategies, defaults, MilestoneType-reuse). Never silently default to Single.
143
+ - **Phase 1.5 — Confirm before mutating.** Narrate the resolved plan (org, SLA name, engagement model
144
+ = per-Incident via `EntitlementId` (no Account), **full per-milestone list** — never collapse to "N
145
+ milestones"); require an explicit "yes" unless a skip
146
+ condition holds (up-front auth / no-op / prior confirmation). Everything after this mutates the org.
147
+ - **Phase 2 — Create SLA artifacts (delegated writes, exact order).** The skill decides every input;
148
+ **delegate each raw write to its approved csp-sun SLA leaf**. The **four ordered core writes**:
149
+ `MilestoneTypes` → `create-sla-policy` (created inactive) → `create-milestone` ×N →
150
+ `activate-sla-policy` (auto-provisions the Entitlement). Do not re-derive Connect shapes.
151
+ `create-entitlement-criteria` is an **optional step 12** — dispatch it **only** on an explicit
152
+ org-wide always-match request; otherwise engagement is per-Incident via `EntitlementId` and no
153
+ criterion is written. The **Priority reconciliation** lands at the milestone step: match every value to
154
+ the live picklist, drop/rename unmatched standard rows, **and add a milestone for each custom active
155
+ value**. Verify via SOQL, not the write response; halt on any milestone-create failure (no
156
+ half-attached policy).
157
+ - **Phase 2-OOB — Seed the predefined policy.** One call to the platform seeder route
158
+ (`PATCH /headless/invoke/platform/slasettings/save-selected-options`, body
159
+ `{"selectedOptions":["incident"]}` — values **lowercase**) provisions the whole active bundle:
160
+ the policy, its 2 MilestoneTypes + 6 milestones, and the Entitlement + auto-apply criteria — all
161
+ active, in one shot. No per-leaf csp-sun calls, no manual `POST /sobjects/Entitlement`, no activate
162
+ PATCH. Detect first (`GET /headless/invoke/platform/slasettings`, key `incident:true` = already
163
+ seeded) because the seeder isn't idempotent. Detect + seed **delegate to `itsm-shakti/SLASettings`**.
164
+ - **Phase 2.5 — Milestone actions (optional).** Only if warn/escalate/notify asked; apply to **every**
165
+ named milestone; confirm from `body.success` + non-empty `actionMappings`, not the `201`.
166
+ - **Phase 3 — Verify.** SOQL-confirm the policy read back `active=true`; create a test Incident on a
167
+ **non-lowest tier** (set `Urgency`/`Impact` — `Priority` is matrix-derived, not directly
168
+ insertable); confirm an `EntityMilestone` on the correct tier with a `TargetDate` (a null
169
+ `SlaStartDate` under auto-apply is a non-blocker). Then report.
257
170
 
258
171
  ---
259
172
 
@@ -261,15 +174,17 @@ contract). Formula, roles, proven body, defaults, IST business-hours note:
261
174
 
262
175
  | Constraint | Rationale |
263
176
  |-----------|-----------|
264
- | Gate **SLA Management** first (Phase 0.5) — one enable turns on the feature **and**, one-way, **SLA Versioning**; **two separate acks (master, then permanence) — never merged**; decline/blocked/verify-fail → **HALT**; re-read + report real state | Versioning is irreversible; writes don't confirm state |
177
+ | Gate **SLA Management** first (Phase 0.5) — **two separate writes** (SLA Management, then the one-way **SLA Versioning**); **two separate acks (master, then permanence) — never merged**; decline/blocked/verify-fail → **HALT**; re-read + report real state | Versioning is irreversible; writes don't confirm state |
265
178
  | Offer **predefined (OOB)** first (Phase 0.6, Incident only); detect before seed; if chosen, seed → verify → **STOP** (no custom upsell) | OOB seed isn't idempotent — re-seed duplicates |
266
179
  | `discover` + `describe` before any mutation | Catches a missing SLA surface / disabled Incident Mgmt early |
267
180
  | Ask (`AskUserQuestion`) the milestone strategy — never silently default to Single | Real ITSM policies have >1 milestone |
268
181
  | Reuse one MilestoneType per shared name; a distinct one per distinct concern | Runtime keys milestones by MilestoneType |
269
- | Multi-milestone: halt on any milestone POST failure (no half-attached policy) | Partial attach diverges from the confirmed plan |
270
- | Priority-tiered: validate every `Priority` value against the live picklist before dispatch | Server accepts any string → an unknown value is a dead milestone |
271
- | Entitlement is standard sObject DML; `StartDate` controls status (future = Inactive) | Not on the `/connect/sla-management/` surface |
182
+ | Multi-milestone: halt on any milestone-create failure (no half-attached policy) | Partial attach diverges from the confirmed plan |
183
+ | Priority-tiered: reconcile every `Priority` value against the live picklist before dispatch — drop/rename standard rows that don't match **and add a milestone for each custom active value** the org added | Server accepts any string → an unknown value is a dead milestone; a custom value with no milestone gets no SLA |
184
+ | **Delegate every write to its approved csp-sun SLA leaf** (`MilestoneTypes`, `create-sla-policy`, `create-milestone`, `create-milestone-action`, `activate-sla-policy`, `create-entitlement-criteria`) — the skill decides inputs, the leaf owns the contract | Single contract-owner per write; the skill re-deriving Connect shapes drifts from the served leaves |
185
+ | **Custom flow**: activation provisions the auto-Entitlement (`activate-sla-policy`: `isActive` + `createEntitlement` as **QUERY params**) — matching Incidents then engage **per-Incident via `EntitlementId`** (**not** a manual sObject Entitlement, and no Account). An org-wide auto-apply criterion via `create-entitlement-criteria` is **optional** — only on an explicit always-match request, never by default. **OOB seed path**: one seeder call (`save-selected-options`, lowercase `selectedOptions`) provisions the entire active bundle incl. the Entitlement — no per-leaf calls, no manual `POST /sobjects/Entitlement`, no activate PATCH | Custom: one call activates **and** provisions, so a manual `POST /sobjects/Entitlement` would duplicate it. OOB: the platform seeder builds and activates the whole default bundle server-side, so the skill neither rebuilds it leaf-by-leaf nor provisions the Entitlement by hand |
272
186
  | **No record Id in any message** (see Output contract, incl. reused artifacts); `AskUserQuestion` labels customer-facing (no "demo"/internal defaults) | The #1 retest failure; leaked Ids / internal framing look unprofessional |
187
+ | **Another Incident policy already active + Custom chosen → narrate coexistence only.** The custom policy is targeted **per-Incident via `EntitlementId`** (Incident has no Account field to scope on) and **additive**; the existing (predefined/broad) policy stays the org-wide one. **Never offer, plan, or perform — in the fork *or* the closing report —** deactivating an existing policy, reordering its entitlement criteria, **broadening the custom policy to match-all / auto-apply-to-all, or "deciding/resolving precedence" across policies**. Target specific Incidents via `EntitlementId`; the existing policy stays active (see `references/workflow.md` → Coexistence) | Changing a policy the user didn't ask to touch is out of scope — this skill configures a *new* coexisting custom policy, not edits to an existing one. Deactivating (`activate-sla-policy` *can* send `isActive=false`) or re-ranking another policy's criteria risks disrupting a live SLA, and no leaf arbitrates cross-policy precedence (predefined: no un-seed path, manual delete only). Both are meant to coexist — the agent otherwise improvises an out-of-scope deactivation/reorder/precedence upsell |
273
188
 
274
189
  Additional API quirks: `references/mcp-invocation.md`.
275
190
 
@@ -277,18 +192,18 @@ Additional API quirks: `references/mcp-invocation.md`.
277
192
 
278
193
  ## Verification Checklist
279
194
 
280
- - [ ] **SLA Management gated (Phase 0.5)** — feature + SLA Versioning both on, only after the **permanence ack** (separate from the master ack); reported state = a re-read, not the write. Declined / blocked / verify-fail → **HALTED** before Phase 0.6/1, no artifacts.
195
+ - [ ] **SLA Management gated (Phase 0.5)** — SLA Management + SLA Versioning both on (two separate writes), only after the **permanence ack** (separate from the master ack); reported state = a re-read, not the write. Declined / blocked / verify-fail → **HALTED** before Phase 0.6/1, no artifacts.
281
196
  - [ ] **Predefined vs Custom offered (Phase 0.6)** — with the feature ON, OOB *Standard Support for Incidents* offered first; if present, reported not re-seeded; if chosen, seeded (2 MilestoneTypes + 6 milestones + Entitlement), verified, **no** custom offer after.
282
197
  - [ ] Master Incident Mgmt pref (exact `service-cloud-itsm-incident`) `ENABLED` via live read, or delegated when `NOT_ENABLED` (`NOT_AVAILABLE` → HALT) — not a user assertion, not a look-alike.
283
198
  - [ ] `discover`/`describe` confirmed the SLA Connect ops.
284
199
  - [ ] Incident describe returned 200 with `EntitlementId`, `SlaStartDate`, `SlaExitDate`.
285
200
  - [ ] Default BusinessHours found.
286
- - [ ] **Milestone strategy resolved** — Phase 1.4 skip condition OR `AskUserQuestion`; Priority-tiered / Custom validated every `Priority`/criteria value against the live picklist before dispatch.
287
- - [ ] **Configuration confirmed OR skip condition met** (up-front auth / no-op / prior confirmation / "yes"); the resolved plan (org, SLA name, account, entitlement range, per-milestone list) narrated before Phase 2.
288
- - [ ] Artifacts created in order (MilestoneType(s) → Policy → Milestone(s) → Entitlement), each POST 201; any milestone POST failure halted (no partial attach). Trivial on no-op.
201
+ - [ ] **Milestone strategy resolved** — Phase 1.4 skip condition OR `AskUserQuestion`; Priority-tiered / Custom reconciled every `Priority`/criteria value against the live picklist before dispatch (dropped/renamed unmatched standard rows **and** added a milestone for each custom active `Priority` value).
202
+ - [ ] **Configuration confirmed OR skip condition met** (up-front auth / no-op / prior confirmation / "yes"); the resolved plan (org, SLA name, engagement model = per-Incident via `EntitlementId` (no Account), per-milestone list) narrated before Phase 2.
203
+ - [ ] Writes **delegated to the csp-sun leaves** in order — the four core writes: MilestoneType(s) → Policy → Milestone(s) → activate + auto-Entitlement (the optional org-wide auto-apply criterion only if explicitly requested); any milestone-create failure halted (no partial attach). Trivial on no-op.
289
204
  - [ ] **Milestone actions (Phase 2.5)** — if requested, attached to **every** named milestone; each confirmed from `body.success` + `actionMappings`, not the `201`; full set narrated before write.
290
205
  - [ ] SLA Policy verified via SOQL, not the create response (no-op: the Phase-1 read is the verification).
291
- - [ ] Test Incident has `SlaStartDate` populated (Priority matched for Priority-tiered) and ≥1 EntityMilestone with correct TargetDate; expected milestone(s) present. Skip on no-op.
206
+ - [ ] Test Incident has ≥1 EntityMilestone on the **correct tier** with a `TargetDate` (the engagement proof; Priority matched for Priority-tiered); expected milestone(s) present. `SlaStartDate` populated confirms it too, but may be null when the Entitlement is auto-applied via criteria — not a failure. Skip on no-op.
292
207
  - [ ] **No record Id in any message** — interim narration *and* final report; artifacts by name, test Incident by `IncidentNumber` (see Output contract).
293
208
  - [ ] Before/after + summary shown; no-op states the pre-existing config verbatim + "no changes made".
294
209
 
@@ -296,7 +211,7 @@ Additional API quirks: `references/mcp-invocation.md`.
296
211
 
297
212
  ## Output Format
298
213
 
299
- Use the `examples/output-templates.md` templates; fill placeholders as-is. The success report must carry, unambiguously: the **SLA Policy**; **every milestone** by MilestoneType name + time + criteria; the **Entitlement → Account**; **every requested action** by milestone + Warning/Violation role + offset + how confirmed; a **Verification** section (SOQL-confirmed policy + test-Incident `SlaStartDate`/EntityMilestones, or an honest partial note); created-vs-reused per artifact; a **scope line** (only the Incident SLA). No record Id anywhere.
214
+ Use the `examples/output-templates.md` templates; fill placeholders as-is. The success report must carry, unambiguously: the **SLA Policy**; **every milestone** by MilestoneType name + time + criteria; the **Entitlement** (auto-provisioned, no Account — Incident has no Account field); **every requested action** by milestone tier/MilestoneType name (never a milestone Id) + Warning/Violation role + offset + how confirmed; a **Verification** section (SOQL-confirmed policy + test-Incident `SlaStartDate`/EntityMilestones, or an honest partial note); created-vs-reused per artifact; a **scope line** (only the Incident SLA). No record Id anywhere. If another Incident policy is already active, state the coexistence plainly (both stay active; the existing/predefined policy stays the broad org-wide one; the custom is targeted per-Incident via `EntitlementId`) and **do not offer to deactivate or reorder it, to broaden the custom policy to auto-apply to all Incidents, or to "decide precedence" across policies**.
300
215
 
301
216
  ---
302
217
 
@@ -304,10 +219,10 @@ Use the `examples/output-templates.md` templates; fill placeholders as-is. The s
304
219
 
305
220
  | File | When to read |
306
221
  |------|--------------|
222
+ | `references/workflow.md` | Executing — the full step-by-step Phase 0–3 detail (per-phase reads, delegated writes, API quirks); the constraints table + verification checklist stay in this SKILL.md body |
307
223
  | `references/mcp-invocation.md` | Every phase — call shapes, templates, response envelope, discovery, gotchas |
308
224
  | `examples/milestone-patterns.md` | Phase 1.4 — the five strategies: times, criteria, MilestoneType reuse, filter extensions |
309
225
  | `assets/attach-milestone.json` | Phase 2 step 10 — milestone POST body; substitute ids/timeTrigger/order; append `filterItems` |
310
- | `assets/predefined-incident-policy.json` | Phase 0.6 / 2-OOB — OOB seed template (policy + 2 MilestoneTypes + 6 milestones, Moderate+Low merged) |
311
226
  | `assets/attach-milestone-action.json` | Phase 2.5 — Warn/Escalate action body templates (Field Update); pair with mcp-invocation.md (Milestone Actions) |
312
227
  | `examples/output-templates.md` | Output Format — success/partial report templates; fill placeholders, no record Id |
313
228
 
@@ -1,8 +1,8 @@
1
1
  {
2
- "_notes": "Phase 2.5 request-body templates for POST /connect/sla-management/sla-policies/<slaId>/milestones/<milestoneId>/actions. Send EXACTLY ONE action sub-object per call. timeLength/timeUnit live INSIDE checkpoint. timeUnit is Minutes|Hours|Days only. Never send isInitiationCheckpoint. Confirm success from body.success + non-empty body.actionMappings (+ triggerId for timed checkpoints), not the 201. UNIQUENESS: the actionFieldUpdate name/developerName must be unique per milestone (a WorkflowFieldUpdate DeveloperName is unique on the Incident object) — attaching the same-named action to a second milestone fails with DUPLICATE_DEVELOPER_NAME. Suffix both with the milestone (e.g. _FR for First Response, _RES for Resolution). These mirror the live-validated 'Proven bodies' in references/mcp-invocation.md (Milestone Actions) — keep the two in sync.",
2
+ "_notes": "Phase 2.5 request-body templates for POST /connect/sla-management/sla-policies/<slaId>/milestones/<milestoneId>/actions. Send EXACTLY ONE action sub-object per call. timeLength/timeUnit live INSIDE checkpoint. timeUnit is Minutes|Hours|Days only. Never send isInitiationCheckpoint. Confirm success from body.success + non-empty body.actionMappings (+ triggerId for timed checkpoints), not the 201. UNIQUENESS: the actionFieldUpdate name/developerName must be unique per milestone (a WorkflowFieldUpdate DeveloperName is unique on the Incident object) — attaching the same-named action to a second milestone fails with DUPLICATE_DEVELOPER_NAME. Suffix both with the milestone (e.g. _FR for First Response, _RES for Resolution). These mirror the example bodies in references/mcp-invocation.md (Milestone Actions — see 'Milestone-action bodies', pending live verification) — keep the two in sync.",
3
3
 
4
4
  "warningAction": {
5
- "_notes": "Warn BEFORE target. timeLength = round(targetMinutes * (1 - X/100)). 2-hr (120-min) milestone, warn at 75% -> 30 min before. Default action = Field Update setting Priority = High. Replace <MS> in name/developerName with a per-milestone suffix. For a custom-field target, put its 00N... CustomField id in columnEnumOrId (not the __c API name).",
5
+ "_notes": "Warn BEFORE target. timeLength = round(targetMinutes * (1 - X/100)). 2-hr (120-min) milestone, warn at 75% -> 30 min before. Default action = Field Update raising Urgency = High. NOTE: Incident.Priority is DERIVED from Impact x Urgency and is NOT directly updateable (createable:false/updateable:false) — a Field Update targeting Priority fails INVALID_FIELD_FOR_INSERT_UPDATE, so escalate by driving its updateable inputs (Urgency here, Impact on breach). Replace <MS> in name/developerName with a per-milestone suffix. For a custom-field target, put its 00N... CustomField id in columnEnumOrId (not the __c API name).",
6
6
  "isSuccessCheckpoint": false,
7
7
  "checkpoint": { "isWarning": true, "timeLength": 30, "timeUnit": "Minutes" },
8
8
  "entityName": "Incident",
@@ -10,7 +10,7 @@
10
10
  "name": "SLA Warn 75pct <MS>",
11
11
  "sourceTable": "Incident",
12
12
  "targetTable": "Incident",
13
- "columnEnumOrId": "Priority",
13
+ "columnEnumOrId": "Urgency",
14
14
  "developerName": "SLA_Warn_75_<MS>",
15
15
  "operationString": "LITERAL",
16
16
  "literal": "High"
@@ -18,7 +18,7 @@
18
18
  },
19
19
 
20
20
  "violationAction": {
21
- "_notes": "Escalate ON breach = Violation with timeLength 0 (fires at target). Default: set Priority = Critical. Replace <MS> in name/developerName with the same per-milestone suffix used for the warning.",
21
+ "_notes": "Escalate ON breach = Violation with timeLength 0 (fires at target). Default: raise Impact = High. If the paired warning action also fired (Urgency already = High), both axes are then High — on a DEFAULT matrix that derives the top Priority tier, but the matrix is org-configurable so the resulting Priority depends on the org's mapping; read the derived Priority back after the action fires to confirm the tier (Priority itself is not directly updateable — see warningAction _notes). Replace <MS> in name/developerName with the same per-milestone suffix used for the warning.",
22
22
  "isSuccessCheckpoint": false,
23
23
  "checkpoint": { "isWarning": false, "timeLength": 0, "timeUnit": "Minutes" },
24
24
  "entityName": "Incident",
@@ -26,10 +26,10 @@
26
26
  "name": "SLA Escalate on Breach <MS>",
27
27
  "sourceTable": "Incident",
28
28
  "targetTable": "Incident",
29
- "columnEnumOrId": "Priority",
29
+ "columnEnumOrId": "Impact",
30
30
  "developerName": "SLA_Escalate_Breach_<MS>",
31
31
  "operationString": "LITERAL",
32
- "literal": "Critical"
32
+ "literal": "High"
33
33
  }
34
34
  },
35
35
 
@@ -24,8 +24,9 @@ milestone shape is already determined by the request:
24
24
  (`"you have my explicit authorization to create"`, `"do not re-ask me to confirm"`,
25
25
  `"proceed without asking"`) **and** a concrete milestone shape is derivable per (a). A passing
26
26
  mention ("build it", "go ahead") is NOT sufficient by itself. Waives the interactive confirm;
27
- does NOT waive Phase 1.5 plan-narration — dispatch only after SLA Policy name, Account,
28
- Entitlement date range, and per-milestone list have been written to the response.
27
+ does NOT waive Phase 1.5 plan-narration — dispatch only after SLA Policy name, the engagement model
28
+ (per-Incident via `EntitlementId`; no Account), and the per-milestone list have been written to the
29
+ response.
29
30
 
30
31
  **Only when none of (a)/(b)/(c) apply** (generic "set up an SLA on Incidents" with no shape),
31
32
  dispatch `AskUserQuestion` with the five options below. Priority-tiered requires the
@@ -35,7 +36,7 @@ All strategies share these defaults unless overridden:
35
36
 
36
37
  - `businessHoursId`: the default BusinessHours resolved in Phase 1 step 4
37
38
  - `startTimeBasedOn`: `MILESTONE_CRITERIA` (timer starts when the milestone's criteria first match; this is the OOB default — send this exact token, see `references/mcp-invocation.md` Attach Milestone)
38
- - `milestoneAgreementType`: `SLA` — inside each `milestoneCriteria[]` item (mandatory per the UI). Valid UI values are `SLA` (customer-facing) or `OLA` (internal); the API accepts any string because the underlying field is `Text(40)` with no server-side picklist, but the UI renders unrecognized values as blank (W-23959162)
39
+ - `milestoneAgreementType`: `SLA` — inside each `milestoneCriteria[]` item (mandatory per the UI). Valid UI values are `SLA` (customer-facing) or `OLA` (internal); the API accepts any string because the underlying field is `Text(40)` with no server-side picklist, but the UI renders unrecognized values as blank
39
40
  - `milestoneState`: `ACTIVE` (**uppercase — the server matches this value case-sensitively**; `Active`/`active` silently fail to register the criterion) inside `milestoneCriteria[]`
40
41
  - `filterType`: `RuleFilter` (inside `milestoneCriteria[]`)
41
42
  - Base filter row: `Incident.Status NotEqual Closed` (keeps every milestone alive until the
@@ -58,16 +59,31 @@ Question: How many milestones do you want on this SLA policy?
58
59
  For options 3 and 4, the concrete numbers are the defaults the skill uses if the user picks the
59
60
  option without customizing. Option 5 dispatches follow-up `AskUserQuestion` prompts.
60
61
 
61
- Before rendering options 3 and 5, confirm the live `Incident.Priority` picklist values (fetched in
62
- Phase 1 via the Incident describe) — if any value used in a default row is missing from the org's
63
- picklist, drop that milestone from the pattern and note it in the Phase-1.5 confirmation.
62
+ Before rendering options 3 and 5, confirm the live `Incident.Priority` picklist values and reconcile
63
+ the pattern against them in **both** directions: if any value used in a default row is missing from
64
+ the org's picklist, drop that milestone; and if the org has **added** active Priority values beyond
65
+ the four default tiers, add a milestone for each so no active Priority value is left without one.
66
+ Note both adjustments in the Phase-1.5 confirmation.
67
+
68
+ **Hard gate — never assume the picklist.** The reconciliation above requires the *actual* live
69
+ `Incident.Priority` picklist. Do **not** present the Priority-tiered milestone list, and do **not**
70
+ state or imply that the picklist "is the four standard tiers" / "needs no reconciliation", **from
71
+ assumption**. The four standard tiers (Critical/High/Moderate/Low) are only *defaults* — they are
72
+ NOT what the org necessarily has. You may present the tier list **only after** the live
73
+ `Incident.Priority` describe (Phase 1 step 3) has actually been dispatched **this session** and you
74
+ have its `fields[].picklistValues` in hand. If it has not run yet — e.g. Custom was invoked
75
+ **directly**, skipping the Phase 0.6 fork where the describe is normally pulled forward — run
76
+ `GET /services/data/v{version}/sobjects/Incident/describe` **now**, before offering or rendering any
77
+ per-priority list, and derive the tiers from its **active** `picklistValues`. An org-added active
78
+ value such as `Emergency` MUST appear as its own milestone; silently defaulting to four tiers leaves
79
+ those Incidents with no milestone and no SLA engagement.
64
80
 
65
81
  ---
66
82
 
67
83
  ## Canonical Attach-Milestone payload
68
84
 
69
85
  Dispatch every pattern below via `mcp__headless-360__dispatch` with `method: "POST"` and
70
- `url: "/services/data/v67.0/connect/sla-management/sla-policies/<slaId>/milestones"` (substitute
86
+ `url: "/services/data/v{version}/connect/sla-management/sla-policies/<slaId>/milestones"` (substitute
71
87
  the SLA policy id captured in Phase 2 step 9). The reusable request-body template lives at
72
88
  `assets/attach-milestone.json` — load and populate it rather than reconstructing the JSON.
73
89
 
@@ -109,7 +125,7 @@ concurrently on its own 8-hour timer.
109
125
  ## Pattern 3 — Priority-tiered response
110
126
 
111
127
  **MilestoneTypes to create:** 1 — `Incident First Response` (reused across all four milestones)
112
- **Milestones to attach:** up to 4 (one per active Priority value)
128
+ **Milestones to attach:** one per active Priority value (the 4 standard tiers below **plus any custom active values** the org has added)
113
129
 
114
130
  | # | Priority | timeTrigger | Extra filter items |
115
131
  |---|----------|-------------|--------------------|
@@ -119,10 +135,18 @@ concurrently on its own 8-hour timer.
119
135
  | 4 | Low | 1440 | `Incident.Priority Equals Low` |
120
136
 
121
137
  Assumes the standard `Critical / High / Moderate / Low` picklist (some orgs and prompts label the
122
- mid tier `Medium` instead of `Moderate` — same P3 tier, different label). If the org has renamed /
123
- removed / added values (checked against the Phase-1 Incident describe), drop or rename milestones
124
- to match — do not send `Priority Equals <value>` for a value that is not in the live picklist (the
125
- server accepts it silently and the milestone never engages).
138
+ mid tier `Medium` instead of `Moderate` — same P3 tier, different label). Reconcile the four default
139
+ rows against the **live `Incident.Priority` picklist** (from the Phase-1 Incident describe) before
140
+ dispatch, handling every difference:
141
+
142
+ - **Renamed** value → rename the milestone's filter to the live label (e.g. `Medium` for the P3 tier).
143
+ - **Removed / inactive** value → drop that milestone. Never send `Priority Equals <value>` for a value
144
+ absent from the live picklist — the server accepts it silently and the milestone never engages.
145
+ - **Added / custom active** value (any active Priority value not covered by the four default rows) →
146
+ **add a milestone for it** so those Incidents still engage an SLA. Reuse the `Incident First Response`
147
+ MilestoneType, filter `Incident.Priority Equals <customValue>`, and confirm its `timeTrigger` with the
148
+ user in Phase 1.5 (offer a sensible default from the nearest standard tier). Do **not** silently skip a
149
+ custom value — an uncovered active Priority means those Incidents get no milestone and no SLA engagement.
126
150
 
127
151
  The multi-item `filterItems` array combines with `AND` by default — both `Status != Closed` AND
128
152
  `Priority == Critical` must hold for the milestone to remain active. If Priority flips after
@@ -196,12 +220,17 @@ and a **Resolve Within** milestone per priority tier:
196
220
  | High | 60 min | 240 min |
197
221
  | Moderate or Low | 240 min | 960 min |
198
222
 
199
- Seed it verbatim from `assets/predefined-incident-policy.json` following the recipe in
200
- `references/mcp-invocation.md` (Predefined Incident Policy) — detect-before-seed (the policy AND the
201
- pre-seeded MilestoneType catalog: reuse `Resolve Within` etc. by name, create only what is missing),
202
- `active: true` on create, validate Priority/Status against the live picklist, and map the mid tier to
203
- the org's real label (`Moderate` or `Medium`). Unlike the custom patterns above, when the user picks
204
- this at the fork the skill seeds → verifies → **stops** (no custom milestone offer after).
223
+ The skill does **not** build this table milestone-by-milestone. One call to the platform seeder route
224
+ (`PATCH /headless/invoke/platform/slasettings/save-selected-options`, body
225
+ `{"selectedOptions":["incident"]}` — lowercase) provisions the whole active bundle server-side: the
226
+ policy, both MilestoneTypes, all 6 milestones (the tiers above), and the Entitlement + auto-apply
227
+ criteria. The table is here so you know what the seeder produces — not a build list. Detect first
228
+ (`GET /headless/invoke/platform/slasettings`, `incident:true` = already seeded) because the seeder
229
+ isn't idempotent. Full recipe: `references/mcp-invocation.md` (Predefined Incident Policy). Unlike the
230
+ custom patterns above, when the user picks this at the fork the skill seeds → verifies → **stops** (no
231
+ *proactive* custom milestone offer after — but an *explicit* request to attach a milestone to the
232
+ seeded policy is honored via a direct `csp-sun/create-milestone` against the policy resolved by name,
233
+ never a re-seed).
205
234
 
206
235
  ---
207
236
 
@@ -210,7 +239,7 @@ this at the fork the skill seeds → verifies → **stops** (no custom milestone
210
239
  | Issue | Detail |
211
240
  |-------|--------|
212
241
  | MilestoneType reuse vs. create | Priority-tiered = 1 MilestoneType reused 4 times. Response + Resolution = 2 types. Escalation ladder = 3 types. |
213
- | Priority-tiered needs a Priority | The test Incident in Phase 3 must have a `Priority` value matching one of the milestones — otherwise no EntityMilestone spawns. Set the Priority explicitly, or create one test Incident per Priority. |
242
+ | Priority-tiered needs a Priority | The test Incident in Phase 3 must derive a `Priority` value matching one of the milestones — otherwise no EntityMilestone spawns. `Priority` is not directly insertable — set `Impact` and `Urgency` so the org's matrix derives the target Priority (see `references/mcp-invocation.md` → Verify SLA engagement), or create one test Incident per tier. |
214
243
  | Multi-milestone partial-failure | If milestone #2 of N fails to attach, halt and surface the raw error. Do NOT continue attaching #3..N — the policy will be half-configured. |
215
244
  | `order` field | Numeric 1..N. Not load-bearing for runtime evaluation (all milestones fire independently), but controls display order in the UI. |
216
- | Priority-tiered + Priority Matrix skill | If the Priority Matrix skill is also running, its Impact × Urgency grid decides `Incident.Priority`. Enable the matrix first if you want new Incidents to derive Priority from the matrix. |
245
+ | Priority-tiered + Priority Matrix skill | `Incident.Priority` is always derived from the Impact × Urgency matrix (a default matrix always exists). The Priority Matrix skill configures the *mapping* (which Impact × Urgency combination yields which Priority) — it does not turn derivation on or off. Run it first if you need a mapping other than the default. |