@salesforce/afv-skills 1.61.0 → 1.63.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 (44) hide show
  1. package/package.json +3 -3
  2. package/skills/agentforce-architecture-analyze/README.md +2 -1
  3. package/skills/agentforce-d360-analyze/README.md +1 -1
  4. package/skills/agentforce-generate/README.md +1 -0
  5. package/skills/crm-analytics-wave-generate/SKILL.md +212 -0
  6. package/skills/crm-analytics-wave-generate/assets/dashboard-template.json +66 -0
  7. package/skills/crm-analytics-wave-generate/assets/wapp-meta-template.xml +10 -0
  8. package/skills/crm-analytics-wave-generate/assets/wdash-meta-template.xml +6 -0
  9. package/skills/crm-analytics-wave-generate/assets/wdpr-meta-template.xml +11 -0
  10. package/skills/crm-analytics-wave-generate/examples/industry-binding-dashboard.wdash +67 -0
  11. package/skills/crm-analytics-wave-generate/examples/opportunity-revenue-recipe.wdpr +132 -0
  12. package/skills/crm-analytics-wave-generate/examples/pipeline-by-industry-quarter.wdpr +236 -0
  13. package/skills/crm-analytics-wave-generate/examples/wdpr-skeleton.wdpr +62 -0
  14. package/skills/crm-analytics-wave-generate/references/dashboard-authoring.md +157 -0
  15. package/skills/crm-analytics-wave-generate/references/dataset-hygiene.md +27 -0
  16. package/skills/crm-analytics-wave-generate/references/external-data-upload.md +61 -0
  17. package/skills/crm-analytics-wave-generate/references/method-decision-tree.md +12 -0
  18. package/skills/crm-analytics-wave-generate/references/r3-node-schema.md +194 -0
  19. package/skills/crm-analytics-wave-generate/references/scripts-reference.md +17 -0
  20. package/skills/crm-analytics-wave-generate/references/ui-section-template.md +68 -0
  21. package/skills/crm-analytics-wave-generate/scripts/check_connector_error.sh +53 -0
  22. package/skills/crm-analytics-wave-generate/scripts/create_app.js +59 -0
  23. package/skills/crm-analytics-wave-generate/scripts/deploy_and_run_recipe.js +122 -0
  24. package/skills/crm-analytics-wave-generate/scripts/fetch_dataset_xmd.js +59 -0
  25. package/skills/crm-analytics-wave-generate/scripts/find_unused_dataset_fields.js +96 -0
  26. package/skills/crm-analytics-wave-generate/scripts/gen_synthetic_dataset.js +137 -0
  27. package/skills/crm-analytics-wave-generate/scripts/patch_t_oppo_view.js +99 -0
  28. package/skills/crm-analytics-wave-generate/scripts/probe_recipe.js +47 -0
  29. package/skills/crm-analytics-wave-generate/scripts/upload_dataset.js +119 -0
  30. package/skills/crm-analytics-wave-generate/scripts/verify_dashboard_steps.js +99 -0
  31. package/skills/crm-analytics-wave-generate/scripts/verify_synthetic_dataset.js +86 -0
  32. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +60 -20
  33. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +5 -1
  34. package/skills/service-itsm-agentic-setup-incident-management/references/incident-persona-psg.md +2 -2
  35. package/skills/service-itsm-agentic-setup-incident-management/references/incident-preferences.md +2 -2
  36. package/skills/service-itsm-agentic-setup-incident-management/references/major-incident-management.md +5 -5
  37. package/skills/service-itsm-agentic-setup-incident-management/references/service-mgmt-privilege.md +5 -5
  38. package/skills/service-itsm-agentic-setup-incident-sla-configure/SKILL.md +67 -100
  39. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/attach-milestone-action.json +2 -2
  40. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/attach-milestone.json +2 -2
  41. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/milestone-patterns.md +23 -22
  42. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/output-templates.md +3 -3
  43. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/mcp-invocation.md +182 -58
  44. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/workflow.md +157 -88
@@ -6,16 +6,39 @@ per-phase step-by-step detail (every read, delegated write, and API quirk). All
6
6
  sequential. **Always read before you write.** Every call goes through `mcp__headless-360__*`
7
7
  tools. Call shapes / templates / response envelope / gotchas live in `references/mcp-invocation.md`.
8
8
 
9
- ## Phase 0 — Reuse what the session already knows
9
+ ## Before you start — Reuse what the session already knows
10
10
 
11
- Each Phase 1 read carries a **skip-if-already-known** clause: skip only when the same fact was
11
+ Each Phase 3a read carries a **skip-if-already-known** clause: skip only when the same fact was
12
12
  produced **this session** by a successful `dispatch_readonly` on the current org and unwritten since —
13
- a user statement is never cache-eligible. Cacheable: master Incident Mgmt pref (step 1, only if
14
- `ENABLED`), SLA feature + Versioning (Phase 0.5), Incident describe (3, incl. the `Incident.Priority`
15
- picklist), `BusinessHoursId` (4), SLA Connect ops (2). (Step 5 resolves no Account — Incident has
13
+ a user statement is never cache-eligible. Cacheable: IT Service Management enablement (Phase 1a,
14
+ only if `ENABLED`), master Incident Mgmt pref (step 1, only if
15
+ `ENABLED`), SLA feature + Versioning (Phase 1b), Incident describe (3, incl. the `Incident.Priority`
16
+ picklist), the priority-matrix flag (Phase 2 step 2), `BusinessHoursId` (4), SLA Connect ops (2). (Step 5 resolves no Account — Incident has
16
17
  none.) **When in doubt, re-check.**
17
18
 
18
- ## Phase 0.5 — SLA Management for IT Service prerequisite gate
19
+ ## Phase 1a — IT Service Management enablement gate
20
+
21
+ **Resolve this gate first, before Phase 1b and before the Master Incident Mgmt pref below.**
22
+ "IT Service Management" (`service-cloud-itsm-setup`) is a higher-level org gate — it sits above every per-feature ITSM master toggle, including Master
23
+ Incident Management. Read via the Setup Discovery Connect API
24
+ (`GET .../connect/setup/discovery/features`), filtered client-side to the **exact** apiName
25
+ `service-cloud-itsm-setup` — never a look-alike. It has two states, `ENABLED` /
26
+ `NOT_ENABLED` (no `NOT_AVAILABLE` — treat any unexpected value as a halt).
27
+
28
+ - `ENABLED` → proceed to Phase 1b.
29
+ - `NOT_ENABLED` → tell the user plainly that IT Service Management is not enabled, then a single
30
+ `AskUserQuestion`: enable it now (note it's **reversible** — it can be disabled again later) or
31
+ stop.
32
+ - **Enable** → dispatch the enable route **directly** — there is no owning SOR to delegate this
33
+ write to yet (unlike the Master Incident Mgmt gate below, which delegates to
34
+ `service-itsm-incident-mgmt-configure`); this is a scoped, temporary exception to "delegate
35
+ every write," flagged for a future delegate swap once a dedicated SOR exists. Halt and surface
36
+ the raw error on any failure. Re-read to confirm `ENABLED` before continuing.
37
+ - **Stop** → halt, point to Setup for manual enablement.
38
+
39
+ Shapes: `references/mcp-invocation.md` (Phase 1a).
40
+
41
+ ## Phase 1b — SLA Management for IT Service prerequisite gate
19
42
 
20
43
  **Resolve this gate first, on its own. Reads are safe up front; confirm the org before any write.**
21
44
  "SLA Management for IT Service" is enabled only when **both** Simplified SLA Setup **and** SLA
@@ -26,8 +49,8 @@ the writes are **delegated to `itsm-shakti/SLASettings`** (owns the SLA-Manageme
26
49
  settings surface) — discover → describe → dispatch rather than re-deriving the routes here.
27
50
  Shapes / preconditions / `enableBlockedReasons` / ack wording: `references/mcp-invocation.md`.
28
51
 
29
- - **Read both** (`dispatch_readonly`); proceed to Phase 0.6 **only when both are on**.
30
- - **On an OFF org, read the master license first** (Phase 1 step 1, `service-cloud-itsm-incident`):
52
+ - **Read both** (`dispatch_readonly`); proceed to Phase 2 **only when both are on**.
53
+ - **On an OFF org, read the master license first** (Phase 3a step 1, `service-cloud-itsm-incident`):
31
54
  `NOT_AVAILABLE` → **HALT** — don't flip the permanent Versioning switch where Incident SLA can't run.
32
55
  - **Two separate `AskUserQuestion` acks — never merge.** (a) master Incident Mgmt `NOT_ENABLED` → ask
33
56
  to enable it first (reversible, no permanence warning). (b) a *distinct* permanence ack: completing
@@ -35,24 +58,24 @@ Shapes / preconditions / `enableBlockedReasons` / ack wording: `references/mcp-i
35
58
  Management disables later but Versioning stays on). Offer **enable**/**stop** — no "versioning-off";
36
59
  a bare "enable SLA" is **not** consent.
37
60
  - **Decline (b), non-empty `enableBlockedReasons`, or a re-read mismatch → HALT** — enable no SLA
38
- Mgmt/Versioning, don't proceed to Phase 0.6/1 (a reversible master enable from (a) stands). **After
61
+ Mgmt/Versioning, don't proceed to Phase 2/3a (a reversible master enable from (a) stands). **After
39
62
  any write, re-read both and report the REAL state** — never trust `201`/`204`.
40
63
 
41
- ## Phase 0.6 — Predefined (OOB) vs Custom
64
+ ## Phase 2 — Predefined (OOB) vs Custom
42
65
 
43
66
  Once the gate passes, offer the OOB policy **before** any custom-flow questions. **Incident only.**
44
67
 
45
- 1. **Prerequisite + detect.** Confirm master Incident Mgmt pref `ENABLED` (Phase 1 step 1). Then
68
+ 1. **Prerequisite + detect.** Confirm master Incident Mgmt pref `ENABLED` (Phase 3a step 1). Then
46
69
  `dispatch_readonly` `GET /headless/invoke/platform/slasettings` (get-existing-checkbox-states) —
47
70
  its lowercase-keyed map's `incident` value is the authoritative "is the OOB default seeded?"
48
71
  answer (this is the seeder's own dedup read; it maps to display name **"Standard Support for
49
- Incidents"**).
72
+ Incidents"**). An empty map `{}` or a missing `incident` key means not seeded.
50
73
  - **`incident: true`** → **no re-seed** (no idempotency), no custom upsell; report it is seeded.
51
- **If warn/escalate actions were requested → resolve the named existing milestones → Phase 2.5 →
52
- Phase 3 verify → STOP** (attach actions even though the policy was already seeded).
74
+ **If warn/escalate actions were requested → resolve the named existing milestones → Phase 5 →
75
+ Phase 6 verify → STOP** (attach actions even though the policy was already seeded).
53
76
  2. **Fork.** **First — before presenting the fork prompt** — read the live `Incident.Priority`
54
- picklist. This is the **Phase 1 step 3 `Incident/describe`** pulled forward (its
55
- `fields[].picklistValues`), cached per Phase 0 — so the Custom branch's Phase 1 step 3 is then a
77
+ picklist. This is the **Phase 3a step 3 `Incident/describe`** pulled forward (its
78
+ `fields[].picklistValues`), cached per “Before you start” — so the Custom branch's Phase 3a step 3 is then a
56
79
  no-op, not a second describe (**Custom-Priority coverage note; informational — NOT an OOB option**). If it carries
57
80
  **custom active values beyond the four standard tiers** (Critical / High / Moderate / Low) — e.g.
58
81
  an org-added `Emergency` — the fork prompt must **say plainly that the predefined policy covers
@@ -60,37 +83,53 @@ Once the gate passes, offer the OOB policy **before** any custom-flow questions.
60
83
  Do **not** *proactively* offer to bolt a milestone for them onto the predefined policy, and **never
61
84
  re-seed** (the seeder builds one fixed bundle server-side and isn't idempotent — re-running
62
85
  duplicates). Point the user to the **Custom** path by default, which reconciles every value against
63
- the live picklist **and adds a milestone for each custom active Priority value** (Phase 1.4 / Phase 2
64
- step 10). **But if the user *explicitly* asks to add a milestone for a custom tier onto the seeded
86
+ the live picklist **and adds a milestone for each custom active Priority value** (Phase 3b / Phase 4A
87
+ step 4). **But if the user *explicitly* asks to add a milestone for a custom tier onto the seeded
65
88
  policy, honor it** — resolve the seeded *Standard Support for Incidents* policy by name (SOQL) and
66
89
  delegate a **direct `csp-sun/create-milestone`** against that policy id (the same milestone-attach op
67
- the Custom flow uses at Phase 2 step 10 — a direct attach, **not** a re-seed of the bundle). The
68
- default decision stays a clean Predefined-vs-Custom fork; the explicit attach is opt-in only. **Then** ask one `AskUserQuestion`, **Predefined first / recommended**:
90
+ the Custom flow uses at Phase 4A step 4 — a direct attach, **not** a re-seed of the bundle). The
91
+ default decision stays a clean Predefined-vs-Custom fork; the explicit attach is opt-in only.
92
+ **Priority matrix note.** Also read the matrix flag (`references/mcp-invocation.md` → Priority
93
+ matrix flag). The predefined policy is priority-tiered, and with the matrix **off** every Incident
94
+ gets the org's default priority, so only that tier's milestones fire. If it is off, say so plainly
95
+ in the fork prompt (when the fork is skipped, on the Priority-tiered option of the strategy
96
+ question instead) and point to `service-itsm-incident-priority-configure` to turn it on. This is a
97
+ warning, not a gate — never enable the matrix from this skill.
98
+ **Business Hours note (only when the user specified hours).** The seeder takes **no** Business Hours
99
+ input — it always attaches the org's active **default** Business Hours (`IsDefault = true`), or none
100
+ if the org has no active default. So if the user named a schedule or described a calendar (e.g.
101
+ "Mon–Fri 9–6 IST"), run the Phase 3a step 4 query first and say plainly in the fork prompt that the
102
+ predefined policy would use *<default name>* (or no Business Hours), **not** their requested hours,
103
+ and recommend **Custom**, which honors them. Never patch the seeded policy's Business Hours after
104
+ the seed. If the user said nothing about hours, add no note and ask nothing about them.
105
+ **Then** ask one `AskUserQuestion`, **Predefined first / recommended** (unless a note above
106
+ redirects to Custom):
69
107
  Salesforce's predefined Incident policy (*Standard Support for Incidents* — priority-tiered) **or**
70
108
  a custom one. One-way: predefined seeds an **active** policy + Entitlement, no un-seed path (manual
71
109
  delete only).
72
110
  - **Predefined →** **do not resolve or ask for an Account.** The seeder wires the policy's
73
- Entitlement and BusinessHours **server-side itself**, so Phase 1 steps 4 (default BusinessHours)
74
- and 5 (Account) are Custom-flow inputs and are **not** run here — asking for an Account on this
75
- branch is an over-ask. The Phase 3 test Incident sets the seeded Entitlement's `EntitlementId`
76
- **directly** (no Account needed). → **Phase 2-OOB** → **Phase 2.5** (if actions requested) →
77
- Phase 3 verify → **STOP**.
78
- - **Custom →** existing Phase 1 → 1.4 → 1.5 → 2 → 3, unchanged.
111
+ Entitlement and BusinessHours **server-side itself** (org default Business Hours), so Phase 3a
112
+ steps 4 (Resolve Business Hours) and 5 (Account) are Custom-flow inputs and are **not** run here
113
+ (beyond the read the Business Hours note above needs) — asking about Business Hours or an Account
114
+ on this branch is an over-ask. The Phase 6 test Incident sets the seeded Entitlement's `EntitlementId`
115
+ **directly** (no Account needed). → **Phase 4B** → **Phase 5** (if actions requested) →
116
+ Phase 6 verify → **STOP**.
117
+ - **Custom →** existing Phase 3a → 3b → 3c → 4A → 5 (if asked) → 6, unchanged.
79
118
 
80
- ## Phase 1 — Preflight & discovery
119
+ ## Phase 3a — Preflight & discovery
81
120
 
82
121
  **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.
83
122
 
84
- 1. **Master Incident Management pref — direct read** *(skip conditions in Phase 0)*.
123
+ 1. **Master Incident Management pref — direct read** *(skip conditions in “Before you start”)*.
85
124
  `dispatch_readonly` `GET .../connect/setup/discovery/features`, filter `features[]` to the **exact**
86
125
  `apiName == "service-cloud-itsm-incident"` — never a look-alike (`service-cloud-incident-management`
87
126
  is generic Case-based Incident Management, not our target). Read `status`: `ENABLED` → proceed;
88
127
  `NOT_AVAILABLE` (license missing) → **halt and surface it** — cannot be enabled here, no delegate/ack;
89
128
  `NOT_ENABLED` → **explicit `AskUserQuestion` ack first (never auto-enable as an implied SLA
90
- dependency)**, then delegate to `service-itsm-incident-mgmt-configure` inline (confirms-to-write) and
91
- re-read; if declined, halt — every SLA artifact below depends on the master being on. Full shape + why
129
+ dependency)**, then delegate to `service-itsm-incident-mgmt-configure` inline — that ack is the
130
+ delegate's confirm-to-write, so never ask twice — and re-read; if declined, halt — every SLA artifact below depends on the master being on. Full shape + why
92
131
  setup-org-preferences 404s here: `references/mcp-invocation.md` (Preflight A).
93
- 2. **Discover the Connect operations** — *(skip if already verified this session — see Phase 0)*.
132
+ 2. **Discover the Connect operations** — *(skip if already verified this session — see “Before you start”)*.
94
133
  `mcp__headless-360__discover(query="sla-management milestone")` to confirm the SLA Management
95
134
  Connect API is indexed, then `mcp__headless-360__describe(id=<operation_id>)`
96
135
  for the `milestone-types`, `sla-policies`, and `sla-policies/{id}/milestones` POST operations to pull
@@ -98,22 +137,38 @@ Once the gate passes, offer the OOB policy **before** any custom-flow questions.
98
137
  the corpus does not index this surface for the org — direct the user to **Setup → SLA/Entitlement
99
138
  setup** and stop.
100
139
  3. **Verify Incident Management + SLA fields** — *(skip if `Incident.describe` result for the
101
- current org is already in context — see Phase 0)*. Otherwise `dispatch_readonly` on
140
+ current org is already in context — see “Before you start”)*. Otherwise `dispatch_readonly` on
102
141
  `GET /services/data/v{version}/sobjects/Incident/describe` and confirm `fields[]` includes
103
142
  `EntitlementId`, `SlaStartDate`, `SlaExitDate`. If the describe 404s or fields are missing, direct
104
143
  the user to enable Entitlement Management for Incident and stop. **This same describe also yields
105
- the live `Incident.Priority` picklist** (`fields[].picklistValues`) consumed by the Phase 0.6 fork
106
- note and the Phase 1.4 / Phase 2 step 10 reconciliation — so on the Custom branch it is already in
107
- context from Phase 0.6 step 2 (Phase 0 skip).
108
- 4. **Find default BusinessHours** — *(skip if `BusinessHoursId` for the current org's default is
109
- already captured this session)*. Otherwise `dispatch_readonly` on `GET /services/data/v{version}/query` with
110
- `query_params.q="SELECT Id, Name FROM BusinessHours WHERE IsActive = true AND IsDefault = true"`.
111
- If `body.records` is empty, stop with a message to create default Business Hours in Setup. Capture
112
- `BusinessHoursId`.
144
+ the live `Incident.Priority` picklist** (`fields[].picklistValues`) consumed by the Phase 2 fork
145
+ note and the Phase 3b / Phase 4A step 4 reconciliation — so on the Custom branch it is already in
146
+ context from Phase 2 step 2 (“Before you start” skip).
147
+ 4. **Resolve Business Hours** — *(skip if the `BusinessHoursId` and name for the current org are
148
+ already captured this session)*. Otherwise `dispatch_readonly` the active Business Hours query
149
+ (`references/mcp-invocation.md` → Resolve Business Hours; returns name, default flag, time zone,
150
+ and weekly windows). Then resolve by what the user said — first match wins:
151
+ - **Named a schedule** ("use EMEA Support hours") → exactly one active record with that name
152
+ (case-insensitive) → use it, **no question**. No match or several → `AskUserQuestion` listing the
153
+ active records by name; on no match also offer **Create "<name>"** — ask its time zone, days
154
+ and start/end time, then plan a create (Phase 4A step 1) under the user's name.
155
+ - **Described a calendar** ("Mon–Fri 9–6 IST", "24×7") → reuse an active record whose time zone and
156
+ weekly windows match, **no question**. None matches → plan to **create** one (Phase 4A step 1),
157
+ named after the description (e.g. `Incident SLA — Mon–Fri 09:00–18:00 IST`).
158
+ - **Named only a time zone** ("use IST", no days or hours) → `AskUserQuestion`: **24×7 in that time
159
+ zone (Recommended)** or **Custom hours**. Custom hours → ask which days and the start/end time.
160
+ Then treat the answer as a described calendar (reuse a match, else plan a create).
161
+ - **Said nothing** → exactly one active `IsDefault=true` record → suggested default, **no
162
+ question**. No default / several / other ambiguity → `AskUserQuestion` listing the active records
163
+ by name.
164
+ - **No active records at all** → tell the user plainly, then `AskUserQuestion`: create a **24×7**
165
+ schedule in the org's time zone (Phase 4A step 1) or stop and create one in Setup.
166
+ Capture the Id internally (never shown) and the name — or "new: `<name>` (to be created)" — for
167
+ Phase 3c. Every create is confirmed at Phase 3c and never sets `IsDefault`.
113
168
  5. **Account — NOT required for Incident; do not resolve or ask for one.** Unlike Case, `Incident`
114
169
  has no customer-`Account` field, and the Custom flow's Entitlement auto-provisions on activation
115
- (`createEntitlement=true`, step 11) **without** an `AccountId` — no write in this flow consumes an
116
- Account (engagement is per-Incident via `EntitlementId`; see step 12). So **skip this step** — asking
170
+ (`createEntitlement=true`, Phase 4A step 5) **without** an `AccountId` — no write in this flow consumes an
171
+ Account (engagement is per-Incident via `EntitlementId`; see Phase 4A step 6). So **skip this step** — asking
117
172
  for an Account here is an over-ask that also seeds the false "Account-scoped auto-apply" premise.
118
173
  (Only revisit if a specific leaf's `describe` proves it hard-requires an `AccountId`; it does not
119
174
  today.) If the user *volunteers* an Account name, acknowledge it but do not treat it as required.
@@ -121,69 +176,77 @@ Once the gate passes, offer the OOB policy **before** any custom-flow questions.
121
176
  name (`... WHERE Name = '<name>' AND SobjectType = 'Incident'` — the field is `SobjectType`;
122
177
  `ProcessType` returns `INVALID_FIELD`), each `MilestoneType` the strategy would create,
123
178
  `SlaMilestone` under the matched policy, and `Entitlement` by name (no Account filter — Incident has none). If
124
- **every** artifact already exists with the requested config, set `noOp=true` and skip Phase 1.4 +
125
- Phase 2 (skip condition (b)); any missing/divergent artifact → proceed to Phase 1.4.
179
+ **every** artifact already exists with the requested config, set `noOp=true` and skip Phase 3b +
180
+ Phase 4A (skip condition (b)); any missing/divergent artifact → proceed to Phase 3b.
126
181
 
127
- **Coexistence with an existing active Incident policy (Custom flow).** When the Phase 0.6 / Phase 1
182
+ **Coexistence with an existing active Incident policy (Custom flow).** When the Phase 2 / Phase 3a
128
183
  reads surface a *different* active Incident SLA policy already present (e.g. a predefined *Standard
129
- Support for Incidents* detected at Phase 0.6 step 1) **and the user has explicitly asked for Custom**
130
- (this is the deliberate-Custom case while that policy stays seeded — not the upsell path Phase 0.6
184
+ Support for Incidents* detected at Phase 2 step 1) **and the user has explicitly asked for Custom**
185
+ (this is the deliberate-Custom case while that policy stays seeded — not the upsell path Phase 2
131
186
  forbids): **do NOT offer to deactivate, replace, or un-scope the existing policy** — changing a policy
132
187
  the user didn't ask to touch is out of this skill's scope and risks disrupting a live SLA (deactivation
133
188
  is technically reachable via `activate-sla-policy` `isActive=false`, but that is not this flow's job),
134
189
  and predefined has **no un-seed path (manual delete only)**. The
135
190
  two are meant to coexist — creating the custom policy never removes or hides the existing one: both
136
191
  remain in **Setup → SLA/Entitlement setup** and both stay usable. The custom policy coexists cleanly
137
- **because it engages per-Incident via `EntitlementId`** (step 12), not by any Account-scoped auto-apply
192
+ **because it engages per-Incident via `EntitlementId`** (Phase 4A step 6), not by any Account-scoped auto-apply
138
193
  (Incident has no Account field to scope on) — narrate that, don't fork on it: "your existing *<name>*
139
194
  policy stays active; this custom policy is applied per-Incident by setting the Incident's Entitlement
140
195
  to it." State the one genuinely singular point without inventing a fix: an Incident engages exactly
141
196
  **one** Entitlement (its `EntitlementId`); to put the custom policy on a specific Incident, set that
142
- Incident's `EntitlementId` to the custom Entitlement (the mechanism Phase 3 already uses) — **never**
143
- reorder or disable the other policy's criteria. Keep this a Phase 1.5 plan-narration, **not** a
197
+ Incident's `EntitlementId` to the custom Entitlement (the mechanism Phase 6 already uses) — **never**
198
+ reorder or disable the other policy's criteria. Keep this a Phase 3c plan-narration, **not** a
144
199
  Replace-vs-Keep-both prompt. **The closing report follows the same rule:** the existing/predefined
145
200
  policy stays the broad org-wide one and the custom is targeted per-Incident — do **not** end the report
146
201
  by offering to broaden the custom policy to auto-apply to **all** Incidents or to "decide/resolve
147
202
  precedence" against the existing policies (there is no leaf that arbitrates cross-policy precedence);
148
203
  point to `EntitlementId` for targeting a specific Incident instead.
149
204
 
150
- ## Phase 1.4 — Milestone Strategy
205
+ ## Phase 3b — Milestone Strategy
151
206
 
152
207
  Every SLA policy needs at least one milestone. Load `examples/milestone-patterns.md` — it lists the
153
208
  skip conditions (concrete shape in prompt / idempotent no-op / explicit up-front authorization) and
154
209
  the five strategy options with their `AskUserQuestion` prompt, defaults, and MilestoneType-reuse
155
- rules. Skip condition (c) still requires Phase 1.5 plan-narration before dispatch. Multi-milestone
156
- selection expands to N creates in Phase 2 step 10 (one delegation per milestone, `order` 1..N, same SlaProcess).
210
+ rules. Skip condition (c) still requires Phase 3c plan-narration before dispatch. Multi-milestone
211
+ selection expands to N creates in Phase 4A step 4 (one delegation per milestone, `order` 1..N, same SlaProcess).
157
212
 
158
- ## Phase 1.5 — Confirm before mutating
213
+ ## Phase 3c — Confirm before mutating
159
214
 
160
- 7. **Confirm the plan** — present the resolved config (target **org**, **SLA Policy** name, the
161
- **engagement model** (per-Incident via `EntitlementId` — **no Account**, since Incident has no
162
- Account field), and the **full per-milestone list** — never collapse Priority-tiered / Custom to
163
- "N milestones"). **Skip the `AskUserQuestion`** (but still narrate the
215
+ 1. **Confirm the plan** — present the resolved config (target **org**, **SLA Policy** name,
216
+ **Business Hours: `<name>`** (and, if Phase 3a step 4 planned a create, its time zone + weekly windows and
217
+ that it will be **created** — a new record this skill does not remove later), the **engagement model** (per-Incident via `EntitlementId` — **no
218
+ Account**, since Incident has no Account field), and the **full per-milestone list** — never
219
+ collapse Priority-tiered / Custom to "N milestones"). For a Priority-tiered plan with the matrix
220
+ off, repeat the Phase 2 matrix note here. **Skip the `AskUserQuestion`** (but still narrate the
164
221
  plan before dispatch) when up-front authorization was granted (note `(authorized in prompt)`), the
165
222
  branch is a no-op, or it was already confirmed in conversation (note `(confirmed in conversation)`);
166
- otherwise require an explicit "yes" before Phase 2. Everything after this step mutates the org.
223
+ otherwise require an explicit "yes" before Phase 4A. Everything after this step mutates the org.
167
224
 
168
- ## Phase 2 — Create SLA Artifacts (delegated writes — exact order, each depends on the previous)
225
+ ## Phase 4A — Create SLA Artifacts (delegated writes — exact order, each depends on the previous)
169
226
 
170
- **The skill decides every input below; the raw writes are delegated to the approved csp-sun SLA leaf
227
+ **The skill decides every input below; the raw writes are delegated to the approved SLA leaf
171
228
  capabilities** (discover → describe → dispatch each) — they own the approved Connect contracts, so do
172
229
  not re-derive request shapes here. Capture each returned `id` for chaining only (never surface it —
173
230
  Output contract).
174
231
 
175
- 8. **MilestoneType(s) → delegate to `csp-sun/MilestoneTypes`.** Decide the set + reuse rule **here**:
232
+ 1. **Business Hours (only if Phase 3a step 4 planned a create).** `dispatch`
233
+ `POST /services/data/v{version}/sobjects/BusinessHours` with the confirmed name, time zone, and
234
+ weekly windows (shape: `references/mcp-invocation.md` → Resolve Business Hours). **Inline, not
235
+ delegated** — no served SOR owns Business Hours writes yet; a scoped exception like the Phase 1a
236
+ enable. Re-read by Id to confirm `IsActive = true` before step 3; on any failure halt and surface
237
+ the raw error (nothing else has been written yet).
238
+ 2. **MilestoneType(s) → delegate to `csp-sun/MilestoneTypes`.** Decide the set + reuse rule **here**:
176
239
  reuse a single MilestoneType across milestones that share a name (Priority-tiered "Incident First
177
240
  Response" is reused across **all** its milestones, including any custom active Priority value);
178
241
  create separate MilestoneTypes for distinct concerns (Response + Resolution = two; Escalation
179
- ladder = three); skip a name the Phase 1 probe already found. Delegate the raw create per required
242
+ ladder = three); skip a name the Phase 3a probe already found. Delegate the raw create per required
180
243
  type; a detected/reused one is narrated by name only (Output contract: name, never `→ <Id>`).
181
- 9. **SLA Policy → delegate to `csp-sun/create-sla-policy`.** Pass `processType='Incident'`, the
182
- default `businessHourId` from Phase 1, and the entry/exit criteria confirmed in Phase 1.5. Created
183
- **inactive** — activation is the explicit step 11 so the auto-entitlement is provisioned. **The
244
+ 3. **SLA Policy → delegate to `csp-sun/create-sla-policy`.** Pass `processType='Incident'`, the
245
+ `businessHourId` resolved in Phase 3a and confirmed in Phase 3c, and the entry/exit criteria
246
+ confirmed there. Created **inactive** — activation is the explicit step 5 so the auto-entitlement is provisioned. **The
184
247
  create response echoes nulls — verify via SOQL, not the body; narrate the policy by name, never
185
248
  the Id** (Output contract).
186
- 10. **Milestone(s) → delegate to `csp-sun/create-milestone`, one delegation per milestone** in
249
+ 4. **Milestone(s) → delegate to `csp-sun/create-milestone`, one delegation per milestone** in
187
250
  ascending time-trigger order (`order` 1..N, same policy). Build each `milestoneCriteria` **here**
188
251
  from `assets/attach-milestone.json` + the per-pattern `filterItems` in
189
252
  `examples/milestone-patterns.md`. **This is where the Priority reconciliation lands:** match every
@@ -193,32 +256,32 @@ Output contract).
193
256
  no-`slaProcessId`-in-body, and confirm-from-body (this endpoint returns `201` even on a failed
194
257
  save) contract. On any failure, halt (no half-attached policy) — narrate each by `MilestoneType`
195
258
  name, never its Id/`triggerId` (Output contract).
196
- 11. **Activate + auto-provision Entitlement → delegate to `csp-sun/activate-sla-policy`.** Activate
259
+ 5. **Activate + auto-provision Entitlement → delegate to `csp-sun/activate-sla-policy`.** Activate
197
260
  the policy and provision its Entitlement in one call — `isActive` and `createEntitlement` are
198
261
  **QUERY params, not a body** (always send `createEntitlement` explicitly). This is the **custom
199
262
  flow only** — it replaces the old `active:true`-on-create + manual `POST /sobjects/Entitlement`.
200
263
  The **OOB seed path does not run this step at all**: its single `save-selected-options` call seeds
201
- an already-active policy and auto-provisions the Entitlement itself (see Phase 2-OOB). The leaf carries the
264
+ an already-active policy and auto-provisions the Entitlement itself (see Phase 4B). The leaf carries the
202
265
  no-500 activation contract: a `200` with a returned `entitlementId` is the success shape. Capture the
203
266
  returned `entitlementId`. **Verify by reading the policy back (`active=true`)**, never the write response.
204
- 12. **Engagement targeting (Incident has NO Account-scoped auto-apply).** Unlike Case, **`Incident`
267
+ 6. **Engagement targeting (Incident has NO Account-scoped auto-apply).** Unlike Case, **`Incident`
205
268
  has no customer-`Account` field** (its only Account-ish field is the polymorphic `ReportedById`),
206
269
  so an Entitlement's auto-apply criteria **cannot be Account-scoped for Incident** — do not attempt
207
270
  it, and **do not ask for or bind an Account for auto-apply scope** (that was an over-ask that also
208
271
  caused a mid-flow contradiction). **Default: per-Incident targeting** — the custom policy engages by
209
- setting an Incident's `EntitlementId` to this policy's Entitlement (the same mechanism Phase 3
272
+ setting an Incident's `EntitlementId` to this policy's Entitlement (the same mechanism Phase 6
210
273
  uses); create **no auto-apply criterion**, and say so in the plan/report ("engages per-Incident via
211
274
  `EntitlementId`; no auto-apply criterion — Incident has no Account field to scope on"). Only if the
212
275
  user **explicitly** wants an org-wide always-match criterion do you delegate to
213
- `csp-sun/create-entitlement-criteria` (`entitlementId` from step 11; leaf owns the uppercase
276
+ `csp-sun/create-entitlement-criteria` (`entitlementId` from step 5; leaf owns the uppercase
214
277
  `AND|OR|CUSTOM` `criteriaType` contract — mixed-case / `RuleFilter` / `Formula` silently fail to
215
278
  open on the Setup edit page; verify by "read every rule in the org, match by `entitlementId`") —
216
279
  and first surface that an always-match criterion **collides** with any existing broad Incident
217
280
  policy (Coexistence rule). Narrate by name, never the Id.
218
281
 
219
- ## Phase 2-OOB — Seed the Predefined Incident Policy
282
+ ## Phase 4B — Seed the Predefined Incident Policy
220
283
 
221
- Reached only from Phase 0.6 Predefined (replaces Phase 1.4/1.5/2). The predefined **"Standard
284
+ Reached only from Phase 2 Predefined (replaces Phase 3b/3c/4A). The predefined **"Standard
222
285
  Support for Incidents"** bundle is seeded by **one** call to the platform's own default-policy
223
286
  seeder — the same action the SLA Settings Setup page runs — served headless on the Aura dispatcher
224
287
  route. Core's seeder builds the entire active bundle itself (policy + MilestoneTypes + milestones +
@@ -232,7 +295,7 @@ Follow the seed recipe in `references/mcp-invocation.md` (**Predefined Incident
232
295
  1. **Detect (dedup).** `dispatch_readonly` `GET /headless/invoke/platform/slasettings`
233
296
  (get-existing-checkbox-states) — its lowercase-keyed map's `incident` value is the authoritative
234
297
  "is the OOB default already seeded?" answer. **`incident: true`** → **no re-seed** (the seeder is
235
- NOT idempotent — re-running duplicates), no custom upsell; report it seeded and skip to Phase 2.5/3.
298
+ NOT idempotent — re-running duplicates), no custom upsell; report it seeded and skip to Phase 5/6.
236
299
  2. **Seed.** `dispatch` `PATCH /headless/invoke/platform/slasettings/save-selected-options` with body
237
300
  `{"selectedOptions": ["incident"]}` — **the value MUST be lowercase `incident`**; the capitalized
238
301
  `Incident` returns a server-side `500`. A `200` with body `true` is success. This provisions the
@@ -240,19 +303,21 @@ Follow the seed recipe in `references/mcp-invocation.md` (**Predefined Incident
240
303
  activate PATCH, so the 500 that path could throw never arises.
241
304
  3. **Verify.** Re-read `GET /headless/invoke/platform/slasettings` and confirm `incident: true`, then
242
305
  SOQL `SlaProcess` for **"Standard Support for Incidents"** `IsActive = true` (do not trust the write
243
- body). Narrate the policy by name, never its Id.
306
+ body), selecting `BusinessHours.Name` too. Narrate the policy by name, never its Id, and report
307
+ which Business Hours it uses by name — or plainly that it has none (no active default existed).
244
308
 
245
- Then Phase 2.5 (if actions requested), Phase 3 (a non-lowest tier — Moderate/Low, not Critical),
309
+ Then Phase 5 (if actions requested), Phase 6 (a non-lowest tier — Moderate/Low, not Critical — subject
310
+ to the Phase 6 step 2 stopping rule),
246
311
  and **STOP** — no *proactive* custom offer. Any custom-Priority coverage gap was surfaced at the
247
- Phase 0.6 fork (as an informational note + redirect to the Custom path), **not** by proactively
312
+ Phase 2 fork (as an informational note + redirect to the Custom path), **not** by proactively
248
313
  augmenting the seeded OOB policy here. **The one exception is an *explicit* user request** to attach a
249
314
  milestone (or a warn/escalate action) to the seeded policy — honor it via a **direct
250
315
  `csp-sun/create-milestone`** (resolve the *Standard Support for Incidents* policy by name; a direct
251
316
  attach, **never** a re-seed), then verify and STOP.
252
317
 
253
- ## Phase 2.5 — Milestone Actions (optional: Warn / Escalate)
318
+ ## Phase 5 — Milestone Actions (optional: Warn / Escalate)
254
319
 
255
- After milestones exist (Phase 2 or 2-OOB), **only if** the user asked to warn/escalate/notify: apply
320
+ After milestones exist (Phase 4A or 4B), **only if** the user asked to warn/escalate/notify: apply
256
321
  the requested checkpoint(s) to **every milestone the user named** (not just one), each offset computed
257
322
  from that milestone's own target. Map "warn at X%" → an offset *before* target, "on breach" →
258
323
  *at/after* it; **confirm the full set before writing** (up-front auth waives the re-ask; narrate it
@@ -260,7 +325,7 @@ regardless — no headless delete), then, per milestone, delegate to headless
260
325
  **`create-milestone-action`** (`discover` → `describe` → `dispatch`). **Confirm each from the response
261
326
  body** (`success` + non-empty `actionMappings`; a *timed* checkpoint also returns a `triggerId`), never
262
327
  the `201`. Narrate each by its **`MilestoneType` name**, never the milestone Id/`triggerId` (Output
263
- contract). **Id-leak guard — the #1 retest failure lands here:** you hold the policy Id and each
328
+ contract). **Id-leak guard — Ids most often leak here:** you hold the policy Id and each
264
329
  milestone Id internally (you need them to target each action write), but the **pre-write plan table
265
330
  AND the closing report MUST key every row by the milestone's tier / Priority / MilestoneType name**
266
331
  (e.g. row header `Emergency`, `Critical`), **never** its Id. Do **not** write `Emergency
@@ -268,25 +333,29 @@ AND the closing report MUST key every row by the milestone's tier / Priority / M
268
333
  parenthetical, or the report — those Ids are chaining-only. Formula, roles, example body, defaults,
269
334
  IST business-hours note: `references/mcp-invocation.md` (Milestone Actions).
270
335
 
271
- ## Phase 3 — Verify
336
+ ## Phase 6 — Verify
272
337
 
273
- 13. **Verify the SLA Policy** — SOQL on `SlaProcess` (do not trust the create response); confirm it
338
+ 1. **Verify the SLA Policy** — SOQL on `SlaProcess` (do not trust the create response); confirm it
274
339
  read back `active=true` — from the activation delegation (Custom flow) or from the seeder (OOB).
275
- 14. **Create a test Incident** to prove engagement — **both flows: set the policy's `EntitlementId`
340
+ 2. **Create a test Incident** to prove engagement — **both flows: set the policy's `EntitlementId`
276
341
  directly on the test Incident** (`Incident` has no Account field, so there is no Account-scoped
277
342
  auto-apply to rely on; `EntitlementId`-direct is the reliable engagement path — Custom uses the
278
343
  Entitlement returned by activation, OOB the seeded Entitlement). For Priority-tiered / OOB
279
344
  strategies, test a tier **other than the lowest `order`** — Critical is order-1, the collapse
280
345
  fallback, so it can't detect a dropped criterion. If a direct `Priority` insert is rejected (it
281
- may be matrix-derived), set `Urgency`/`Impact` to derive the tier. Narrate by `IncidentNumber`,
282
- never the Id.
283
- 15. **Verify engagement + tiering** — SOQL that an `EntityMilestone` landed on the **correct tier**
346
+ may be matrix-derived), set `Urgency`/`Impact` to derive the tier and read `Priority` back.
347
+ **Stopping rule:** if the matrix flag is off, create **one** test Incident only. If the matrix is on
348
+ but the derived `Priority` is still the order-1 tier after **one** `Impact`/`Urgency` adjustment,
349
+ stop creating test Incidents. Either way, report that the SLA engages but the other tiers were not
350
+ checked, say why (matrix off / matrix maps these inputs to that tier), and point to
351
+ `service-itsm-incident-priority-configure`. Narrate by `IncidentNumber`, never the Id.
352
+ 3. **Verify engagement + tiering** — SOQL that an `EntityMilestone` landed on the **correct tier**
284
353
  (a Moderate/Low Incident → the 240/960 tier, NOT 30/120) with a `TargetDate` — that row is the
285
354
  reliable engagement proof. `Incident.SlaStartDate` is populated when you set `EntitlementId` at
286
355
  insert, but can be **null** when the Entitlement is auto-applied via criteria (the milestone still
287
356
  lands); treat a null `SlaStartDate` as a non-blocker, not a failure. The create `201` always
288
357
  echoes `milestoneCriteria:[]`; only this runtime read proves the ACTIVE criteria persisted.
289
- 16. **Report results** using the output format in `examples/output-templates.md`.
358
+ 4. **Report results** using the output format in `examples/output-templates.md`.
290
359
 
291
360
  ---
292
361