@salesforce/afv-skills 1.69.0 → 1.70.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.
- package/package.json +1 -1
- package/skills/data360-code-extension-generate/SKILL.md +160 -252
- package/skills/data360-code-extension-generate/references/README.md +34 -172
- package/skills/data360-code-extension-generate/references/environment-setup.md +198 -0
- package/skills/data360-code-extension-generate/references/mcp-integration.md +36 -0
- package/skills/data360-code-extension-generate/references/quick-reference.md +132 -202
- package/skills/data360-code-extension-generate/references/run-logs.md +31 -0
- package/skills/data360-code-extension-generate/references/schema-discovery.md +45 -0
- package/skills/data360-code-extension-generate/references/troubleshooting.md +45 -0
- package/skills/data360-code-extension-generate/scripts/check_env.sh +197 -0
- package/skills/data360-code-extension-generate/scripts/venv_hook.sh +22 -0
- package/skills/dx-devops-work-item-manage/SKILL.md +24 -8
- package/skills/dx-devops-work-item-manage/examples/common-workflows.md +32 -0
- package/skills/dx-devops-work-item-manage/references/review-api.md +95 -0
- package/skills/dx-org-manage/SKILL.md +12 -12
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +1 -3
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +1 -3
- package/skills/dx-org-manage/references/opening-org.md +1 -1
- package/skills/dx-org-manage/references/scratch-org-operations.md +15 -20
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +1 -1
- package/skills/education-cloud-academic-calendar-generate/SKILL.md +2 -2
- package/skills/education-cloud-course-catalog-migrate/SKILL.md +1 -1
- package/skills/education-cloud-domain-configure/references/domain-features/recruitment-admissions.md +8 -7
- package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -0
- package/skills/education-cloud-multi-campus-configure/references/error_handling.md +7 -6
- package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +5 -4
- package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +1 -1
- package/skills/experience-cms-content-type-generate/SKILL.md +7 -6
- package/skills/experience-cms-content-type-generate/references/agent-checklist.md +3 -3
- package/skills/experience-cms-content-type-generate/references/anti-patterns.md +2 -2
- package/skills/experience-cms-content-type-generate/references/discovery-details.md +1 -1
- package/skills/experience-cms-content-type-generate/references/retrieve-and-reconcile.md +5 -9
- package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.mjs +10 -0
- package/skills/field-service-data-capture-migrate/references/converter-builder-contract.md +2 -2
- package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +2 -2
- package/skills/field-service-data-capture-migrate/scripts/analyze_flow.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/convert_to_dc_spec.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/fsm_dc_catalog.py +2 -2
- package/skills/field-service-data-capture-migrate/scripts/generate_summary.py +2 -2
- package/skills/platform-custom-application-generate/SKILL.md +97 -104
- package/skills/platform-custom-application-generate/references/app-properties.md +52 -0
- package/skills/platform-custom-application-generate/references/app-visibility.md +19 -0
- package/skills/platform-custom-application-generate/references/utility-bar.md +55 -0
- package/skills/platform-datamask-run/SKILL.md +1 -1
- package/skills/platform-datamask-run/references/policy-authoring.md +41 -18
- package/skills/platform-dsar-policy-manage/SKILL.md +7 -6
- package/skills/platform-dsar-policy-manage/references/export-and-history.md +10 -8
- package/skills/platform-dsar-policy-manage/references/report-format.md +4 -2
- package/skills/platform-metadata-grounding-get/SKILL.md +7 -7
- package/skills/platform-report-generate/SKILL.md +9 -7
- package/skills/platform-report-generate/references/column-names.md +12 -1
- package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
- package/skills/platform-sharing-rules-generate/SKILL.md +12 -3
- package/skills/platform-sharing-rules-generate/references/rule-types.md +1 -0
- package/skills/service-agentforce-channel-configure/SKILL.md +6 -3
- package/skills/service-agentforce-channel-configure/references/agent-wiring.md +5 -3
- package/skills/service-agentforce-channel-configure/references/channel-branch-email.md +24 -15
- package/skills/service-agentforce-channel-configure/references/input-validation.md +23 -0
- package/skills/service-agentforce-channel-configure/references/live-traffic-gate.md +13 -7
- package/skills/service-agentforce-channel-configure/references/queue-resolution.md +3 -1
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/input-validation.md +23 -0
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/queue-resolution.md +146 -0
- package/skills/service-agentforce-human-escalation-configure/references/escalation-mechanism.md +1 -1
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/_bootstrap.py +42 -11
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/test_escalation_contracts.py +45 -0
- package/skills/service-agentforce-human-escalation-configure/scripts/verify-and-configure.sh +23 -9
- package/skills/service-de-channel-activate/SKILL.md +10 -10
- package/skills/service-de-channel-activate/references/gotchas.md +4 -4
- package/skills/service-de-channel-activate/references/phone-verification.md +43 -19
- package/skills/service-de-channel-create/SKILL.md +1 -1
- package/skills/service-de-channel-create/references/facebook.md +1 -1
- package/skills/service-de-channel-create/references/whatsapp.md +33 -6
- package/skills/service-de-channel-routing-configure/SKILL.md +5 -1
- package/skills/service-de-channel-routing-configure/references/gotchas.md +3 -1
- package/skills/service-de-channel-routing-configure/references/named-queue.md +39 -0
- package/skills/service-de-channel-settings-configure/SKILL.md +3 -1
- package/skills/service-de-channel-settings-configure/references/channel-settings-facets.md +2 -2
- package/skills/service-de-channel-settings-configure/references/gotchas.md +12 -1
- package/skills/service-de-headless-channel-configure/SKILL.md +68 -74
- package/skills/service-de-headless-channel-configure/references/gotchas.md +6 -2
- package/skills/service-de-headless-channel-configure/references/inputs.md +19 -0
- package/skills/service-de-headless-channel-configure/references/output-envelopes.md +23 -1
- package/skills/service-de-headless-channel-configure/references/partial-success.md +1 -0
- package/skills/service-de-headless-channel-configure/references/requested-settings.md +55 -0
- package/skills/service-de-headless-channel-configure/references/worked-examples.md +35 -1
- package/skills/service-digital-engagement-channel-configure/SKILL.md +3 -3
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +2 -2
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +1 -1
- package/skills/service-digital-engagement-deployment-configure/SKILL.md +2 -2
- package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +4 -2
- package/skills/service-digital-engagement-deployment-configure/scripts/check-api-version.sh +1 -1
- package/skills/service-omni-command-center-configure/SKILL.md +1 -1
- package/skills/data360-schema-get/SKILL.md +0 -388
- package/skills/data360-schema-get/references/README.md +0 -191
- package/skills/data360-schema-get/scripts/get_dlo_schema.py +0 -244
- package/skills/data360-schema-get/scripts/get_dmo_schema.py +0 -233
- package/skills/field-service-prework-brief-deployer-configure/SKILL.md +0 -646
- package/skills/field-service-voice-to-form-configure/SKILL.md +0 -650
|
@@ -5,19 +5,21 @@ consent, poll-before-download) lives in `SKILL.md`; this file is the mechanics.
|
|
|
5
5
|
|
|
6
6
|
## Resolve the DSR routes at run time
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
salesforce-api-context # MCP: resolve the current DSR execute/status/getfile routes + API version
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Or discover via `sf`:
|
|
8
|
+
Resolve execute / status / getfile through the routing tool's `describe` and `dispatch` first.
|
|
9
|
+
Only when no routing tool is available, obtain the endpoint paths, methods, inputs, and handle
|
|
10
|
+
contract from the target release's Connect API documentation or a verified contract supplied by
|
|
11
|
+
the user, then discover the org's available API versions via `sf`:
|
|
16
12
|
|
|
17
13
|
```bash
|
|
18
14
|
sf api request rest '/services/data' --target-org <alias> # available API versions
|
|
19
15
|
```
|
|
20
16
|
|
|
17
|
+
Select a returned version supported by that contract; keep route placeholders below until verified.
|
|
18
|
+
`/services/data` lists versions, **not DSR routes**. Metadata XML schema assets do not discover
|
|
19
|
+
Connect endpoints either. If a route/handle contract cannot be verified, report the missing
|
|
20
|
+
capability and stop that operation — do not guess paths, probe by executing exports, or fall back
|
|
21
|
+
from an available router. The `DsarPolicyLog` SOQL status/history reads below remain available.
|
|
22
|
+
|
|
21
23
|
## Resolve the subject (B0) — before anything else
|
|
22
24
|
|
|
23
25
|
A portability request names the subject by **email / name / external id**, not a `dataSubjectId`.
|
|
@@ -27,14 +27,16 @@ authoritative map of guessed personal data.
|
|
|
27
27
|
(1) the **resolved subject** — identifier (email/name/id) → root-entity Id + type — and the
|
|
28
28
|
**policy chosen** (noting if it was ambiguous and you asked); (2) consent confirmed, or the run
|
|
29
29
|
withheld as ambiguous; (3) that this was an **export, not a deletion**; (4) the **poll ordering**
|
|
30
|
-
made explicit —
|
|
30
|
+
made explicit — execute, poll, interpret the envelope/run status, then retrieve the file only after terminal success;
|
|
31
31
|
an early not-ready response is expected, and if still non-terminal you **asked** the user before
|
|
32
32
|
continuing (never looped); stated even on the accepted preflight-error path; (5) outcome from the
|
|
33
33
|
**envelope / run status** in plain terms — running / completed / errored — not the HTTP code; (6)
|
|
34
|
-
file location on success (from the `dsr` getfile route, after terminal); (7) any missing
|
|
34
|
+
file location on success (from the `dsr` getfile route, after confirmed terminal success); (7) any missing
|
|
35
35
|
permission/feature named with the raw error. A non-terminal run is a valid stopping point — report
|
|
36
36
|
it as *still running* and defer to the user, don't diagnose the async backend.
|
|
37
37
|
|
|
38
|
+
Terminal failure is not permission to download. Read and report the outcome before deciding whether to call getfile; HTTP 201 alone does not establish success. Preserve this order in proposed commands as well as executed calls.
|
|
39
|
+
|
|
38
40
|
**Preflight-error path (feature/policy/subject absent — the run never started):** keep it short.
|
|
39
41
|
Lead with the blocker(s) and the prerequisite to unblock each; state export-not-deletion **once**;
|
|
40
42
|
state the poll-then-download ordering **once** (a single short paragraph — this is item 4, not a
|
|
@@ -6,7 +6,7 @@ metadata:
|
|
|
6
6
|
- data360-code-extension-generate
|
|
7
7
|
- platform-metadata-discovery-get
|
|
8
8
|
- platform-metadata-retrieve
|
|
9
|
-
version: "2.
|
|
9
|
+
version: "2.3"
|
|
10
10
|
accessCheck: "CDP.orgHasUnifiedCatalogProvisioned"
|
|
11
11
|
domains:
|
|
12
12
|
- "Platform"
|
|
@@ -56,7 +56,7 @@ The Salesforce MCP is shown in Setup today as the Headless360 (H360) MCP Server.
|
|
|
56
56
|
| Order | Server | How to call |
|
|
57
57
|
|---|---|---|
|
|
58
58
|
| 1 | Metadata Grounding MCP | Call `search_metadata`, `query_metadata`, or `describe_metadata` with the inputs below. |
|
|
59
|
-
| 2 | Salesforce MCP, when the Metadata Grounding MCP is not connected or keeps failing | Call `describe` on the operation id `searchMetadata`, `queryMetadata`, or `describeMetadata`. Do not use `discover`, and do not describe the grounding recipe, which is too large to read. Then call the path `describe` returns with the same inputs. Use `dispatch_readonly` for `searchMetadata` and pass the
|
|
59
|
+
| 2 | Salesforce MCP, when the Metadata Grounding MCP is not connected or keeps failing | Call `describe` on the operation id `searchMetadata`, `queryMetadata`, or `describeMetadata`. Do not use `discover`, and do not describe the grounding recipe, which is too large to read. Then call the path `describe` returns with the same inputs. Use `dispatch_readonly` for `searchMetadata` and pass `query` and the required `metadataType` as query parameters. Use `dispatch` for `queryMetadata` and `describeMetadata`, which are POST calls but only read, and pass the inputs as the JSON body. Do not use other metadata search operations. |
|
|
60
60
|
| Neither connected | | Grounding is not available. Use the name and label fallback in `platform-metadata-discovery-get`. |
|
|
61
61
|
|
|
62
62
|
## When a Call Fails
|
|
@@ -73,7 +73,7 @@ A missing tool, an access error, or a 404 is not proof that the metadata does no
|
|
|
73
73
|
|
|
74
74
|
| Call | Metadata Grounding MCP | Salesforce MCP |
|
|
75
75
|
|---|---|---|
|
|
76
|
-
| Search | `{results, totalCount}
|
|
76
|
+
| Search | Wrapped as `{defaultExc: "<json string>", responseCode}`. Parse `defaultExc` to read `{results, totalCount}`. | Payload in the response body, not wrapped |
|
|
77
77
|
| Describe and query | Wrapped as `{defaultExc: "<json string>", responseCode}`. Parse the `defaultExc` string to read `types`, `typeDetails`, or `records`. | Payload in the response body, not wrapped |
|
|
78
78
|
| Error | An array of `{errorCode, message}` | Same array in the response body |
|
|
79
79
|
|
|
@@ -97,19 +97,19 @@ Type names are case-sensitive, and some differ from Metadata API names.
|
|
|
97
97
|
|
|
98
98
|
Most other types use the Metadata API name, for example `ApexClass`, `ApexTrigger`, `Flow`, `PermissionSet`, `PermissionSetGroup`, `Profile`, `ValidationRule`, `RecordType`, `SharingRule`, `FieldPermissions`, `PicklistValue`, and `CustomPermission`.
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Always call `describe_metadata` before searching. If you do not know the relevant catalog type, call it without a `metadataType` and read only the returned type names; the full response is about 29K characters. If you have a likely type, call describe with that `metadataType` to validate it and learn its properties and subtypes.
|
|
101
101
|
|
|
102
102
|
## Search
|
|
103
103
|
|
|
104
104
|
Inputs:
|
|
105
105
|
- `query`: required plain-language phrase. An empty query returns `ILLEGAL_QUERY_PARAMETER_VALUE`.
|
|
106
|
-
- `metadataType`:
|
|
107
|
-
- `
|
|
106
|
+
- `metadataType`: required catalog type name returned by `describe_metadata`. Search does not support an unfiltered cross-type call.
|
|
107
|
+
- `metadataSubTypes` (Metadata Grounding MCP): array of subtype names returned by describe. Required and nonempty when the type defines subtypes; omit it for types without subtypes. Include all relevant subtypes in one call.
|
|
108
108
|
- `parentIdentifier`: optional, to search inside one object or permission container.
|
|
109
109
|
- `limit`: 1 to 100, default 50. Use 10 to 20.
|
|
110
110
|
|
|
111
111
|
How to search well:
|
|
112
|
-
1. **
|
|
112
|
+
1. **Start with describe, then search with a type.** Call `describe_metadata` first, then pass a returned `metadataType` on every search. For broad questions, run a few typed searches on likely types, such as `SObject`, `SObjectField`, and `Flow`; include the relevant returned subtypes when the type defines them. Never make an unfiltered search.
|
|
113
113
|
2. **Search inside an object** by passing its returned identifier as `parentIdentifier`. First search `SObject` for the exact object API name, or reuse a field result's `parentIdentifier`, then copy the identifier unchanged. Never pass the raw object API name. This finds fields related to a topic. It is not a full field list.
|
|
114
114
|
3. **Try one more phrasing** with synonyms or likely labels before you report "no match found in the org catalog."
|
|
115
115
|
4. **Trust the service's exposure policy.** Do not infer visibility or support from API-name suffixes. Keep results relevant to the user's requested domain; intentionally exposed Data Cloud metadata must remain available when it is relevant.
|
|
@@ -7,10 +7,10 @@ metadata:
|
|
|
7
7
|
minApiVersion: "60.0"
|
|
8
8
|
relatedSkills:
|
|
9
9
|
- "platform-custom-report-type-generate"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
semver: ">=
|
|
10
|
+
- "platform-metadata-api-context-get"
|
|
11
|
+
cliTools:
|
|
12
|
+
- tool: ["sf"]
|
|
13
|
+
semver: ">=2.0.0"
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
## Overview
|
|
@@ -19,9 +19,11 @@ Lightning Reports define how Salesforce data is queried, grouped, filtered, and
|
|
|
19
19
|
|
|
20
20
|
## Critical Rules (Read First)
|
|
21
21
|
|
|
22
|
+
**REQUIRED before authoring XML:** Invoke `platform-metadata-api-context-get` and consume only the required sections of its `Report` entry (`fields`, relevant `sub_types`, and targeted schema/examples as needed). These assets describe XML structure, not the target org's report-type columns; use `references/column-names.md` or its report-type lookup for column names.
|
|
23
|
+
|
|
22
24
|
**TOP DEPLOYMENT KILLERS — check these BEFORE generating any report:**
|
|
23
25
|
1. **Grouping fields in columns** — Fields in `<groupingsDown>` or `<groupingsAcross>` must NEVER also appear in `<columns>`
|
|
24
|
-
2. **Wrong column names (REQUIRED lookup)** — Before writing any `<columns>`, `<groupingsDown>`, `<groupingsAcross>`, filter `<column>`, or chart `<groupingColumn>`, take every name from the table for the chosen `<reportType>` in `references/column-names.md`, or confirm it with
|
|
26
|
+
2. **Wrong column names (REQUIRED lookup)** — Before writing any `<columns>`, `<groupingsDown>`, `<groupingsAcross>`, filter `<column>`, or chart `<groupingColumn>`, take every name from the table for the chosen `<reportType>` in `references/column-names.md`, or confirm it with the report-type lookup documented there. NEVER derive a column name from the field's API name: `CASENUMBER`, `ISCLOSED`, `PHONE`, `MAILING_CITY` all fail (use `CASE_NUMBER`, a `STATUS` filter, `PHONE1`, `ADDRESS2_CITY`)
|
|
25
27
|
3. **Wrong scope** — LeadList uses `org`, not `organization`
|
|
26
28
|
4. **Filter column dot notation** — Filter `<column>` values use FLAT names (`INDUSTRY`, `TYPE`) NOT dot notation (`ACCOUNT.INDUSTRY` is INVALID)
|
|
27
29
|
5. **Multi-value picklist filters** — Use ONE `<criteriaItems>` with comma-separated `<value>` (e.g., `Technology,Financial Services`). Do NOT split into multiple criteriaItems with booleanFilter
|
|
@@ -41,7 +43,7 @@ Lightning Reports define how Salesforce data is queried, grouped, filtered, and
|
|
|
41
43
|
|
|
42
44
|
### Rule 2: Use Platform Column Names
|
|
43
45
|
|
|
44
|
-
Report metadata uses **platform report column names**, NOT raw API field names. **ALWAYS
|
|
46
|
+
Report metadata uses **platform report column names**, NOT raw API field names. **ALWAYS confirm valid column names** using `references/column-names.md` or its report-type lookup. The required schema-context invocation above verifies XML structure, not report-type columns.
|
|
45
47
|
|
|
46
48
|
### Rule 3: Valid Report Type Required
|
|
47
49
|
|
|
@@ -162,7 +164,7 @@ Common operators: `equals`, `notEqual`, `lessThan`, `greaterThan`, `contains`, `
|
|
|
162
164
|
|
|
163
165
|
1. **Gather Requirements** — object, fields, groupings, filters, chart needs
|
|
164
166
|
2. **Determine Format** — no groupings → Tabular; row groupings → Summary; row + column → Matrix; multiple objects → Joined
|
|
165
|
-
3. **Look Up Every Column Name (required)** — list every field the report needs, then take each name from the `references/column-names.md` table for the chosen `<reportType>` or confirm it with
|
|
167
|
+
3. **Look Up Every Column Name (required)** — list every field the report needs, then take each name from the `references/column-names.md` table for the chosen `<reportType>` or confirm it with the report-type lookup documented there. Do not write XML until every column, grouping, filter column, and chart grouping column is looked up
|
|
166
168
|
4. **Author Metadata** — start from closest example in `examples/` and adapt
|
|
167
169
|
5. **Create Folder** — generate folder directory + `<FolderName>-meta.xml` with `<folderShares>`
|
|
168
170
|
6. **Validate** — run through `references/verification-checklist.md`
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# Column Names by Report Type
|
|
2
2
|
|
|
3
|
-
Report metadata uses **platform report column names**, NOT raw API field names. These names are report-type-specific — ALWAYS verify
|
|
3
|
+
Report metadata uses **platform report column names**, NOT raw API field names. These names are report-type-specific — ALWAYS verify against the tables below, the custom report type's section layout, or the target org's report-type metadata.
|
|
4
|
+
|
|
5
|
+
## Target-org report-type lookup
|
|
6
|
+
|
|
7
|
+
For columns not covered below, use the read-only [Report Type REST resource](https://developer.salesforce.com/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-reporttypes-reference-reporttype.html):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
sf api request rest '/services/data' --target-org <alias>
|
|
11
|
+
sf api request rest '/services/data/v<supported-version>/analytics/reportTypes/<report-type-API-name>' --target-org <alias>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Select an API version returned by the org. Match fields through `reportTypeMetadata.categories[].columns`: use each column map's key as the report column name, not its label or `entityColumnName`. Check `filterable` before using a filter. For custom report types, confirm the XML `$` path against the section layout below; do not blindly copy REST field IDs into XML. Metadata schema assets do not enumerate org-specific columns. If neither the bundled mappings/layout nor a successful lookup establishes a column, report the gap and stop rather than inventing it.
|
|
4
15
|
|
|
5
16
|
## Standard Report Type API Names
|
|
6
17
|
|
|
@@ -5,7 +5,7 @@ Read this when a generated `.report-meta.xml` is rejected during deployment or f
|
|
|
5
5
|
| Error | Cause | Fix |
|
|
6
6
|
|-------|-------|-----|
|
|
7
7
|
| `Invalid report type 'X'` | Report type doesn't exist or isn't deployed in the target org | Verify the report type API name. For custom report types, ensure `<deployed>true</deployed>` is set. Use `platform-custom-report-type-generate` skill to create if missing |
|
|
8
|
-
| `Invalid field 'X' for report type 'Y'` | Column name not recognized for the report type — used raw field API name instead of platform column name | Use platform column names (e.g. `ACCOUNT_NAME` not `Account.Name`). For custom fields, use `ObjectApiName.FieldApiName__c`. Use `
|
|
8
|
+
| `Invalid field 'X' for report type 'Y'` | Column name not recognized for the report type — used raw field API name instead of platform column name | Use platform column names (e.g. `ACCOUNT_NAME` not `Account.Name`). For custom fields, use `ObjectApiName.FieldApiName__c`. Use the report-type lookup in `column-names.md` to discover valid column names |
|
|
9
9
|
| `Grouping field 'X' not found in columns` | A `<groupingsDown>` or `<groupingsAcross>` field is not also listed as a `<columns>` entry | Add the grouping field as a `<columns>` block |
|
|
10
10
|
| `Chart not valid for Tabular format` | `<chart>` element present on a Tabular report | Remove the chart or change format to `Summary` or `Matrix` |
|
|
11
11
|
| `Summary report requires at least one grouping` | Format is `Summary` but no `<groupingsDown>` is defined | Add at least one `<groupingsDown>` block or change format to `Tabular` |
|
|
@@ -35,7 +35,7 @@ Before proceeding, confirm with the user if not already clear:
|
|
|
35
35
|
### For Create operations:
|
|
36
36
|
- Which object should the sharing rule apply to? (standard or custom object API name)
|
|
37
37
|
- What type of rule? (criteria-based, role/group-based owner rule, or guest user rule)
|
|
38
|
-
- Who should records be shared with? (role name, group, portal role, or guest user nickname)
|
|
38
|
+
- Who should records be shared with? (role name, public group, portal role, or guest user nickname; a queue can't be shared with)
|
|
39
39
|
- What access level? (Read or Read/Write)
|
|
40
40
|
- For criteria-based rules: what field conditions should match?
|
|
41
41
|
|
|
@@ -55,7 +55,7 @@ Gather or infer before proceeding:
|
|
|
55
55
|
|
|
56
56
|
- **Object API name**: The sObject the rule targets (e.g., `Account`, `Property__c`)
|
|
57
57
|
- **Rule type**: One of `sharingCriteriaRules`, `sharingOwnerRules`, or `sharingGuestRules`
|
|
58
|
-
- **Shared-to target**: Role, group, portal role, or guest user community nickname
|
|
58
|
+
- **Shared-to target**: Role, public group, portal role, or guest user community nickname. A queue can't be a shared-to target
|
|
59
59
|
- **Access level**: `Read` or `Edit` (maps to Read-Only or Read/Write)
|
|
60
60
|
- **Criteria** (for criteria/guest rules): Field name, operation, and value for each filter item
|
|
61
61
|
|
|
@@ -93,6 +93,12 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
|
|
|
93
93
|
|
|
94
94
|
7. **For Guest rules**: the `sharedTo` must use `<guestUser>` with the site guest user's community nickname. Never use `<role>` or `<group>` for guest rules.
|
|
95
95
|
|
|
96
|
+
**A queue can't be the shared-to target.** A queue is valid only as the `<sharedFrom>` of an owner rule (records owned by the queue). If the user asks to share records with a queue, or the shared-with name doesn't resolve as a role or public group, check whether it is a queue:
|
|
97
|
+
```bash
|
|
98
|
+
sf data query --query "SELECT Id, DeveloperName, Name FROM Group WHERE Type = 'Queue' AND (DeveloperName = '<name>' OR Name = '<name>')" --target-org <org>
|
|
99
|
+
```
|
|
100
|
+
If it is a queue, stop before writing any file: tell the user a sharing rule can't share records with a queue, and offer a public group with the same members or a role instead. Never put a queue in `<sharedTo>`, as `<queue>` or `<group>`: the deploy fails with "field integrity exception: unknown (invalid user or group)".
|
|
101
|
+
|
|
96
102
|
### Phase 3 — Execute Operation
|
|
97
103
|
|
|
98
104
|
#### For Get:
|
|
@@ -159,6 +165,7 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
|
|
|
159
165
|
- [ ] Does `<fullName>` use PascalCase with no spaces?
|
|
160
166
|
- [ ] Is `<label>` present and human-readable?
|
|
161
167
|
- [ ] Is `<accessLevel>` one of `Read` or `Edit`?
|
|
168
|
+
- [ ] Is `<sharedTo>` free of queues (no `<queue>`, and no queue name in `<group>`)?
|
|
162
169
|
|
|
163
170
|
### Criteria Rule Checks
|
|
164
171
|
- [ ] Is `<includeRecordsOwnedByAll>` present (required boolean)?
|
|
@@ -172,7 +179,7 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
|
|
|
172
179
|
|
|
173
180
|
### Owner Rule Checks
|
|
174
181
|
- [ ] Does the rule have both `<sharedFrom>` and `<sharedTo>` elements?
|
|
175
|
-
- [ ] Do both use valid `<role>`, `<roleAndSubordinates>`, or `<group>` targets?
|
|
182
|
+
- [ ] Do both use valid `<role>`, `<roleAndSubordinates>`, or `<group>` targets? (`<sharedFrom>` may also use `<queue>`; `<sharedTo>` never can)
|
|
176
183
|
|
|
177
184
|
### Edit Operation Checks
|
|
178
185
|
- [ ] Was the edit against a freshly retrieved file (not a stale local copy)?
|
|
@@ -203,6 +210,7 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
|
|
|
203
210
|
|-----------|-----------|
|
|
204
211
|
| One `.sharingRules-meta.xml` file per object | Platform requirement — multiple files cause deployment errors |
|
|
205
212
|
| Guest rules must use `<guestUser>` in `sharedTo` | Using `<role>` or `<group>` causes: "Specify a guest user's nickname for the guestUser field" |
|
|
213
|
+
| A queue can't be a `sharedTo` target | Queues are valid only in `sharedFrom` of owner rules. A queue in `sharedTo` (as `<queue>` or `<group>`) fails at deploy with: "field integrity exception: unknown (invalid user or group)" |
|
|
206
214
|
| Account rules require `<accountSettings>` | Without it: "AccountSettings is required for account sharing rules" |
|
|
207
215
|
| `includeRecordsOwnedByAll` is required on criteria rules | Missing it causes: "Required field is missing: sharingCriteriaRules" |
|
|
208
216
|
| `includeHVUOwnedRecords` is required on guest rules | Missing it causes deployment failure |
|
|
@@ -224,6 +232,7 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
|
|
|
224
232
|
| Issue | Resolution |
|
|
225
233
|
|-------|------------|
|
|
226
234
|
| Guest rule uses `<role>` instead of `<guestUser>` | Replace with `<guestUser>CommunityNickname</guestUser>` |
|
|
235
|
+
| User asks to share records with a queue | Not supported — don't write the rule. Explain that a queue can only be the owned-by side of an owner rule, and offer a public group with the same members or a role |
|
|
227
236
|
| Account rule missing `accountSettings` | Add `<accountSettings>` with all three access level sub-elements set to `None` |
|
|
228
237
|
| Criteria rule missing `includeRecordsOwnedByAll` | Add `<includeRecordsOwnedByAll>true</includeRecordsOwnedByAll>` |
|
|
229
238
|
| Picklist value mismatch | Query the org for valid values before generating criteria |
|
|
@@ -153,6 +153,7 @@ The `<sharedTo>` (and `<sharedFrom>` for owner rules) element specifies the targ
|
|
|
153
153
|
| `<portalRoleAndSubordinates>PortalRoleName</portalRoleAndSubordinates>` | Portal role + subordinates |
|
|
154
154
|
| `<allInternalUsers>AllInternalUsers</allInternalUsers>` | All internal users |
|
|
155
155
|
| `<allCustomerPortalUsers>AllCustomerPortalUsers</allCustomerPortalUsers>` | All customer portal users |
|
|
156
|
+
| `<queue>QueueDeveloperName</queue>` | Records owned by a queue (`sharedFrom` of owner rules only; never valid in `sharedTo`) |
|
|
156
157
|
|
|
157
158
|
---
|
|
158
159
|
|
|
@@ -51,6 +51,8 @@ This skill is generic — it works for any Agentforce agent, not just the Help A
|
|
|
51
51
|
- **Channel identifier** — MessagingChannel `DeveloperName` (Branch A), or the channel name/context (Branches B/C)
|
|
52
52
|
- **Target org alias**
|
|
53
53
|
|
|
54
|
+
Validate AGENT_DEVELOPER_NAME matches `^[A-Za-z][A-Za-z0-9_]{0,79}$`, and every other input per `references/input-validation.md`, before the first command. On a mismatch, stop and ask; never escape and continue.
|
|
55
|
+
|
|
54
56
|
---
|
|
55
57
|
|
|
56
58
|
## Workflow
|
|
@@ -98,9 +100,9 @@ Never bypass this gate — a mistaken production write here reroutes live custom
|
|
|
98
100
|
|
|
99
101
|
### Phase 2 — Wire inbound routing
|
|
100
102
|
|
|
101
|
-
#### Live-traffic warning gate (
|
|
103
|
+
#### Live-traffic warning gate (before any routing change)
|
|
102
104
|
|
|
103
|
-
Before
|
|
105
|
+
Before any routing change (Branches A/B: at Phase 2 start; Branch C: after its Step 1 address choice), detect whether the channel already has active inbound routing. If it does, first check whether the user's prompt already answered the timing choice ("do not cut over" / "wire manually" / "review first" → defer silently; "cut over now" / "activate immediately" → proceed silently). Only if the prompt is silent, warn via `AskUserQuestion` and let the user choose **"Re-route now"** or **"Set up, then wire manually"** — and on any ambiguous or no-selection response, default to the deferred path (never to a live re-route). When deferred, set `DEFER_INBOUND_ROUTING=true`, skip every step that binds the channel or routing address to the agent, and print the manual wiring instructions at the end of Phase 2.
|
|
104
106
|
|
|
105
107
|
If the channel has no existing routing, skip this gate entirely and proceed directly.
|
|
106
108
|
|
|
@@ -217,7 +219,7 @@ write or verification steps here.
|
|
|
217
219
|
| If the channel already has active inbound routing, honor an explicit defer/cutover intent in the prompt without asking; otherwise warn via `AskUserQuestion` and default to defer on ambiguity | Re-routing takes effect immediately and affects live traffic — queue and RoutingFlow creation always proceed; only the activation step is gated, and the safe default is non-destructive |
|
|
218
220
|
| When deferred, print exact manual wiring instructions before Phase 3 | The operator needs to know precisely what to run when they're ready to cut over |
|
|
219
221
|
| Never modify the MessagingChannel without retrieving the current metadata first | Overwriting without retrieval discards existing settings |
|
|
220
|
-
| Branch A: no RoutingFlow, no agent republish; deploy `sessionHandlerType` + `sessionHandlerQueue` via metadata, then bind `SessionHandlerId` via Data API PATCH |
|
|
222
|
+
| Branch A: no RoutingFlow, no agent republish; deploy `sessionHandlerType` + `sessionHandlerQueue` via metadata, then bind `SessionHandlerId` via Data API PATCH | The Metadata API silently drops `sessionHandlerAsa` at v67, so the bot binds via the PATCH and must be Active first |
|
|
221
223
|
| Branches B/C: always create a new RoutingFlow — never reuse existing org flows | OOB platform flows commonly have `ActiveVersionId: null` and cannot be referenced |
|
|
222
224
|
| Branches B/C: use `routingType: Copilot` and `copilotLabel` — not `QueueBased` | `QueueBased` routes to the queue directly; `Copilot` routes to the agent first with the queue as fallback |
|
|
223
225
|
| Queue `Id` must be queried and embedded in the RoutingFlow XML | The `queueId` parameter requires a hardcoded 18-char record Id — do not leave it empty |
|
|
@@ -268,6 +270,7 @@ write or verification steps here.
|
|
|
268
270
|
|
|
269
271
|
| File | When to read |
|
|
270
272
|
|---|---|
|
|
273
|
+
| `references/input-validation.md` | Before any command — input grammars, free text |
|
|
271
274
|
| `references/channel-types.md` | Phase 1 — determine SobjectType and routing branch |
|
|
272
275
|
| `references/queue-resolution.md` | Phase 1 — queue lookup, creation, and Id capture |
|
|
273
276
|
| `references/live-traffic-gate.md` | Phase 2 — detection queries, deferred-flow rules, and manual wiring copy for the live-traffic warning gate |
|
|
@@ -87,11 +87,13 @@ If a block for the relevant connection type already exists in the file, **add th
|
|
|
87
87
|
## Republish and activate the agent
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
|
-
sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
|
|
91
|
-
sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
|
|
92
|
-
echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --json
|
|
90
|
+
sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
91
|
+
sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
92
|
+
echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
Always pass `--target-org` — without it the CLI acts on the default org, which may not be the org cleared by the Phase 0 write-guard.
|
|
96
|
+
|
|
95
97
|
## Verify the wiring round-tripped
|
|
96
98
|
|
|
97
99
|
After publish, retrieve the bundle and check:
|
|
@@ -11,8 +11,10 @@ Resolve the org's **true max** supported API version and stop if it is below 68.
|
|
|
11
11
|
```bash
|
|
12
12
|
ORG_API_VERSION=$(sf api request rest --target-org "$ORG" "/services/data" \
|
|
13
13
|
| python3 -c "import sys, json; print(max((v['version'] for v in json.load(sys.stdin)), key=float))")
|
|
14
|
+
API_VERSION_RE='^[0-9]{2}\.[0-9]$'
|
|
15
|
+
[[ "$ORG_API_VERSION" =~ $API_VERSION_RE ]] || { echo "Org API version '$ORG_API_VERSION' fails the ORG_API_VERSION grammar. Stopping without making changes."; exit 1; }
|
|
14
16
|
|
|
15
|
-
python3 -c "import sys; sys.exit(0 if float(
|
|
17
|
+
python3 -c "import sys; sys.exit(0 if float(sys.argv[1]) >= 68.0 else 1)" "$ORG_API_VERSION" || {
|
|
16
18
|
echo "Org API version $ORG_API_VERSION is below 68.0 — Agentforce Email-to-Case (BotEmailDefinition) is not available on this org. Stopping without making changes."
|
|
17
19
|
exit 1
|
|
18
20
|
}
|
|
@@ -53,6 +55,8 @@ Ask the user via `AskUserQuestion`:
|
|
|
53
55
|
> *"What email address should receive support emails? This is the address customers will email — e.g. `support@yourcompany.com`.*
|
|
54
56
|
> *Note: Salesforce will send a verification email to this address. You must click the verification link before inbound emails will be processed."*
|
|
55
57
|
|
|
58
|
+
Validate `SUPPORT_EMAIL` against its grammar in `input-validation.md` before any command uses it; if it doesn't match, ask again. Never escape and continue: the value is pasted into the `--values` string below and into SOQL and XML later.
|
|
59
|
+
|
|
56
60
|
2. Create the `EmailRoutingAddress` record:
|
|
57
61
|
```bash
|
|
58
62
|
sf data create record --target-org $ORG \
|
|
@@ -94,7 +98,7 @@ Ask the user via `AskUserQuestion`:
|
|
|
94
98
|
|
|
95
99
|
### If using an existing routing address
|
|
96
100
|
|
|
97
|
-
Set `ROUTING_ADDRESS_ID` to the selected record's `Id` and continue. No provisioning steps needed.
|
|
101
|
+
Set `ROUTING_ADDRESS_ID` to the selected record's `Id` and `SUPPORT_EMAIL` to its `Address`, validate both per `input-validation.md`, and continue. No provisioning steps needed.
|
|
98
102
|
|
|
99
103
|
---
|
|
100
104
|
|
|
@@ -145,10 +149,10 @@ This is a surface-only add with no outbound flow, so it is self-contained here
|
|
|
145
149
|
|
|
146
150
|
3. Republish and activate. The agent is already active at this point (Phase 1), and **publishing a surface/connection change onto an active agent fails** with `We couldn't find the default agent user <username>` — the active version holds the agent user, so it must be released first. Deactivate → publish → activate:
|
|
147
151
|
```bash
|
|
148
|
-
echo "Y" | sf agent deactivate --api-name {AGENT_DEVELOPER_NAME} --json
|
|
149
|
-
sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
|
|
150
|
-
sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --json
|
|
151
|
-
echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --json
|
|
152
|
+
echo "Y" | sf agent deactivate --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
153
|
+
sf agent validate authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
154
|
+
sf agent publish authoring-bundle --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
155
|
+
echo "Y" | sf agent activate --api-name {AGENT_DEVELOPER_NAME} --target-org "$ORG" --json
|
|
152
156
|
```
|
|
153
157
|
|
|
154
158
|
**Batch escalation here to avoid a second publish cycle.** Each surface/connection change on an active agent costs a full deactivate → publish → activate. If the user will also want outbound escalation (Phase 3), wire it in *this* edit instead of republishing again later: resolve the escalation queue and create the outbound `QueueBased` RoutingFlow first (`references/queue-resolution.md`, `references/routing-flow.md`), then add the outbound-route fields to this same `connection service_email:` block (per `references/agent-wiring.md`) before the single publish/activate above — the surface `description` and the outbound route then go live together.
|
|
@@ -161,6 +165,8 @@ Verify the block is present in the deployed bundle before continuing. Escalation
|
|
|
161
165
|
|
|
162
166
|
The `BotEmailDefinition` component links the agent to Service Email (the "Agentforce for Service on Email" feature). Read `references/botemaildefinition.md` in full before this step. Run this only after Step 3 confirmed `connection service_email:` is deployed on the agent.
|
|
163
167
|
|
|
168
|
+
Create a private work directory once with `mktemp -d` and use the path it prints as `{WORK_DIR}` in Steps 4c and 4d. Shell variables don't persist between commands, so substitute the literal path. Don't use a fixed `/tmp` path: another local user can create it first and swap the files you deploy.
|
|
169
|
+
|
|
164
170
|
### Step 4a — Preflight the save-time gates (fail fast, in Core's order)
|
|
165
171
|
|
|
166
172
|
`BotEmailDefinition`'s save-time validation runs in a fixed order (see `references/botemaildefinition.md`). Check the agent-side gates now so a deploy failure isn't the first signal:
|
|
@@ -203,17 +209,17 @@ The agent needs an ASA-valid `EmailTemplate` (`uiType=SFX`, HTML, public, contai
|
|
|
203
209
|
|
|
204
210
|
Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and `replyAll` (reply-all vs reply-to-sender) from the user. Choose a `DeveloperName`, e.g. `{AgentDevName}_Email_Config`.
|
|
205
211
|
|
|
206
|
-
1. Copy `assets/BotEmailDefinition.botEmailDefinition-meta.xml` to
|
|
212
|
+
1. Copy `assets/BotEmailDefinition.botEmailDefinition-meta.xml` to `{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml` and substitute `{AGENT_DEVELOPER_NAME}`, `{EMAIL_TEMPLATE_FOLDER}/{EMAIL_TEMPLATE_DEVELOPER_NAME}` (= `EMAIL_TEMPLATE`), `{LABEL}`, `{LEGAL_DISCLAIMER_TEXT}`, `{SIGNATURE_TEXT}`, and `replyAll`. Make the substitutions with the Edit/Write tools, never `sed` or a heredoc, and XML-escape the free-text values (`input-validation.md`).
|
|
207
213
|
|
|
208
214
|
2. Validate:
|
|
209
215
|
```bash
|
|
210
|
-
python3 scripts/validate-botemaildefinition.py /
|
|
216
|
+
python3 scripts/validate-botemaildefinition.py "{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml"
|
|
211
217
|
```
|
|
212
218
|
Resolve any errors before deploying.
|
|
213
219
|
|
|
214
220
|
3. Assemble the metadata-format package and deploy (source deploy naming the type directly fails — it is absent from the SDR registry):
|
|
215
221
|
```bash
|
|
216
|
-
MDDIR
|
|
222
|
+
MDDIR="{WORK_DIR}/botemaildef-mdapi"
|
|
217
223
|
mkdir -p "$MDDIR/botEmailDefinitions"
|
|
218
224
|
# package.xml: from assets/mdapi-package.xml, substituting the member name and
|
|
219
225
|
# {API_VERSION} = ORG_API_VERSION from the Precondition.
|
|
@@ -221,7 +227,7 @@ Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and
|
|
|
221
227
|
-e "s/{API_VERSION}/{ORG_API_VERSION}/" \
|
|
222
228
|
assets/mdapi-package.xml > "$MDDIR/package.xml"
|
|
223
229
|
# component file: same XML as the source file, WITHOUT the -meta.xml suffix
|
|
224
|
-
cp /
|
|
230
|
+
cp "{WORK_DIR}/{DeveloperName}.botEmailDefinition-meta.xml" \
|
|
225
231
|
"$MDDIR/botEmailDefinitions/{DeveloperName}.botEmailDefinition"
|
|
226
232
|
sf project deploy start --metadata-dir "$MDDIR" --target-org $ORG --json
|
|
227
233
|
```
|
|
@@ -233,10 +239,11 @@ Elicit `label`, `legalDisclaimer` (≥10 chars), `signature` (≥10 chars), and
|
|
|
233
239
|
|
|
234
240
|
In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EMAIL}` from Step 1): the `botEmailDefinition` binding to `BOT_EMAIL_DEFINITION_NAME`, **plus** the Step 2 inbound-routing fields — either `caseOwner` = `BOT_USER_USERNAME` + `caseOwnerType: User` (Path A), or `routingFlow` = `INBOUND_FLOW_DEVELOPER_NAME` + `fallbackQueue` = `QUEUE_DEVELOPER_NAME` (Path B). `casePriority` is **required** on every routing address — carry it, or the deploy fails with `Missing casePriority`. A settings deploy **replaces** the `emailToCase.routingAddresses` collection, so the deployed file must carry **every** existing address — dropping one unbinds it. There is no pre-existing `Case.settings-meta.xml` in the project; you must generate it from the current org state first.
|
|
235
241
|
|
|
236
|
-
1. **Read the current CaseSettings** to get the full `emailToCase` block, including all routing addresses:
|
|
242
|
+
1. **Read the current CaseSettings** to get the full `emailToCase` block, including all routing addresses. Keep the response as the pre-deploy snapshot; the read-back check after point 3 compares against it:
|
|
237
243
|
```bash
|
|
238
244
|
sf api request rest -o "$ORG" --method GET \
|
|
239
|
-
"/services/data/v{ORG_API_VERSION}/tooling/query?q=SELECT+Metadata+FROM+CaseSettings+LIMIT+1"
|
|
245
|
+
"/services/data/v{ORG_API_VERSION}/tooling/query?q=SELECT+Metadata+FROM+CaseSettings+LIMIT+1" \
|
|
246
|
+
> "{WORK_DIR}/casesettings-before.json"
|
|
240
247
|
```
|
|
241
248
|
|
|
242
249
|
2. **Write `Case.settings-meta.xml`** to the project's settings directory (e.g. `force-app/main/default/settings/Case.settings-meta.xml`). Include the `emailToCase` toggles and **one `<routingAddresses>` entry per existing address** from the read. For each address, carry over **every** field the read returned except the read-only `emailServicesAddress`/`isVerified` — preserve whatever the org actually set (e.g. `addressType`, `caseOrigin`, `emailAddress`, `routingName`, and fields like `casePriority`), rather than a fixed subset. On the entry whose `emailAddress` matches `{SUPPORT_EMAIL}`, add `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` plus the Step 2 path's fields. The example below shows **Path A** (case owner); for **Path B**, swap in `<routingFlow>`+`<fallbackQueue>` instead:
|
|
@@ -259,14 +266,16 @@ In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EM
|
|
|
259
266
|
<!-- Path B: replace <caseOwner>/<caseOwnerType> with
|
|
260
267
|
<fallbackQueue>{QUEUE_DEVELOPER_NAME}</fallbackQueue> + <routingFlow>{INBOUND_FLOW_DEVELOPER_NAME}</routingFlow>.
|
|
261
268
|
casePriority is required. Include whatever else the read returned (minus emailServicesAddress/isVerified).
|
|
262
|
-
Repeat <routingAddresses> for every OTHER existing address,
|
|
269
|
+
Repeat <routingAddresses> for every OTHER existing address, carrying every field over exactly as read
|
|
270
|
+
(including any botEmailDefinition, caseOwner, caseOwnerType, routingFlow, fallbackQueue, casePriority).
|
|
271
|
+
Only the target address changes. -->
|
|
263
272
|
</emailToCase>
|
|
264
273
|
</CaseSettings>
|
|
265
274
|
```
|
|
266
275
|
|
|
267
276
|
3. **Deploy in metadata format** so the version comes from the manifest — do **not** mutate `sfdx-project.json`. A source deploy of `Settings:Case` reads `sourceApiVersion` (which `--api-version` does not override), so pinning it there would persist to every later deploy in the user's project. Assemble a metadata-format package versioned at `ORG_API_VERSION` (already ≥68.0 from the Precondition — `botEmailDefinition` on a routing address needs v68.0+):
|
|
268
277
|
```bash
|
|
269
|
-
MDDIR
|
|
278
|
+
MDDIR="{WORK_DIR}/casesettings-mdapi"
|
|
270
279
|
mkdir -p "$MDDIR/settings"
|
|
271
280
|
# package.xml: from assets/settings-mdapi-package.xml, {API_VERSION} = ORG_API_VERSION.
|
|
272
281
|
sed -e "s/{API_VERSION}/{ORG_API_VERSION}/" \
|
|
@@ -276,7 +285,7 @@ In one `Settings:Case` metadata deploy, set on the routing address (`{SUPPORT_EM
|
|
|
276
285
|
sf project deploy start --metadata-dir "$MDDIR" --target-org $ORG --json
|
|
277
286
|
```
|
|
278
287
|
|
|
279
|
-
Verify the read-back (`emailToCase.routingAddresses`): the **set of `emailAddress` values matches the pre-deploy set** — not just that the count is unchanged, since a dropped-and-added swap preserves the count — and the target address (`{SUPPORT_EMAIL}`) now carries `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` and the chosen path's fields (`<caseOwner>` with `caseOwnerType` `User`, or `<routingFlow>`+`<fallbackQueue>`). If any pre-deploy address is missing from the read-back, stop and surface it — a live routing address was unbound.
|
|
288
|
+
Verify the read-back (`emailToCase.routingAddresses`): the **set of `emailAddress` values matches the pre-deploy set** — not just that the count is unchanged, since a dropped-and-added swap preserves the count — and the target address (`{SUPPORT_EMAIL}`) now carries `<botEmailDefinition>{BOT_EMAIL_DEFINITION_NAME}</botEmailDefinition>` and the chosen path's fields (`<caseOwner>` with `caseOwnerType` `User`, or `<routingFlow>`+`<fallbackQueue>`). If any pre-deploy address is missing from the read-back, stop and surface it — a live routing address was unbound. Then compare every **non-target** address field by field with `casesettings-before.json` (including `botEmailDefinition`, `caseOwner`, `caseOwnerType`, `routingFlow`, `fallbackQueue`, and `casePriority`). If any field changed, stop and report the drift — another address's live routing was altered.
|
|
280
289
|
|
|
281
290
|
Branch C is complete once the binding is verified. Outbound escalation is added via Phase 3 (`agent-wiring.md`) exactly like the other channels — offer it rather than skipping it (the user can decline; it does not block inbound completion). If you already batched the outbound route into the Step 3 `connection service_email:` block, escalation is done — just confirm `outboundRouteName`/`outboundRouteType` round-tripped (per `agent-wiring.md`) instead of republishing.
|
|
282
291
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Input validation (before any command)
|
|
2
|
+
|
|
3
|
+
Every `{PLACEHOLDER}` in this skill's commands is pasted, unescaped, into a shell string, a SOQL literal, or metadata XML. A stray `'`, `;`, `$(...)`, or `<` in a value would rewrite the command or the deployed file. Check each value against its grammar before the first command that uses it. This covers values the user types and values read back from the org (Ids, `Address`, `Queue.Name`, the org's username and API version).
|
|
4
|
+
|
|
5
|
+
On a mismatch, stop and ask the user for a corrected value. Never escape and continue: an escaped value that reaches the org is still not the name the user meant. For a value read back from the org, say which record failed; when adopting an existing queue, offer to create a new one instead.
|
|
6
|
+
|
|
7
|
+
| Value | Grammar |
|
|
8
|
+
|---|---|
|
|
9
|
+
| DeveloperName / API name: `AGENT_DEVELOPER_NAME`, `CHANNEL_DEVELOPER_NAME`, `QUEUE_DEVELOPER_NAME`, and every flow or `BotEmailDefinition` name | `^[A-Za-z][A-Za-z0-9_]{0,79}$` |
|
|
10
|
+
| Record Id: `BOT_ID`, `BOT_USER_ID`, `CHAN_ID`, `QUEUE_ID`, `ROUTING_ADDRESS_ID`, `CASE_SETTINGS_ID` | `^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$` |
|
|
11
|
+
| Queue label: `QUEUE_NAME` (typed, or an existing queue's `Name`) | `^[A-Za-z0-9][A-Za-z0-9 _.-]{0,79}$` |
|
|
12
|
+
| `CAPACITY_PERCENTAGE` | `^[0-9]{1,3}$` (an integer from the `queue-resolution.md` table) |
|
|
13
|
+
| `ORG_API_VERSION` | `^[0-9]{2}\.[0-9]$` |
|
|
14
|
+
| `SUPPORT_EMAIL` | `^[A-Za-z0-9][A-Za-z0-9._%+-]*@[A-Za-z0-9][A-Za-z0-9.-]*\.[A-Za-z]{2,}$` |
|
|
15
|
+
| `ORG` (alias or username), `ORG_USERNAME` | `^[A-Za-z0-9][A-Za-z0-9._@+-]*$` |
|
|
16
|
+
|
|
17
|
+
None of these grammars admits a quote, `;`, `$`, backtick, `|`, `&`, `<`, or `>`, and none lets a value start with `-`, so a matching value can't escape its shell, SOQL, `sed`, or XML context or be read as a CLI option. Only `QUEUE_NAME` admits a space, and every command quotes it.
|
|
18
|
+
|
|
19
|
+
`ORG_USERNAME` and `ORG_API_VERSION` are captured into a shell variable and used in the same block, so their commands check the grammar inline with `[[ ... =~ ... ]]` before first use.
|
|
20
|
+
|
|
21
|
+
## Free text
|
|
22
|
+
|
|
23
|
+
Values with no grammar above can't be passed through the shell: labels other than `QUEUE_NAME`, `legalDisclaimer`, `signature`, `routingName`, escalation messages, and the bot user's username (`BOT_USER_USERNAME`). Write them into the metadata file with the Edit/Write tools, XML-escaping `&` → `&`, `<` → `<`, `>` → `>`, `"` → `"`, and `'` → `'`. A value that must reach a shell command needs a grammar in the table first.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Live-traffic warning gate (Phase 2)
|
|
2
2
|
|
|
3
|
-
Runs once, before
|
|
3
|
+
Runs once per Phase 2, before the first step that changes routing: at the start of Branch A or B, and in Branch C right after the Step 1 address choice, since whether routing is live depends on which address is chosen (Steps 0–1 bind nothing to the agent). Prevents an unattended re-route of live traffic on a channel that already has active inbound routing.
|
|
4
4
|
|
|
5
5
|
## Detect existing routing
|
|
6
6
|
|
|
7
7
|
- **Branch A (Enhanced Chat / Enhanced Messaging):** retrieve the MessagingChannel and inspect `SessionHandlerType`. If it is non-empty, routing is live.
|
|
8
|
-
- **
|
|
8
|
+
- **Branch B (Voice):** routing is live if the `PstnVoice` MessagingChannel already has a non-null `SessionHandlerId`, or if `FlowDefinitionView WHERE ProcessType='RoutingFlow'` shows a flow assigned to this service channel with a non-null `ActiveVersionId`.
|
|
9
|
+
- **Branch C (Email-to-Case):** run this check after the Step 1 address choice in `channel-branch-email.md`. An **existing** routing address chosen there is live: it already turns inbound email into cases, so changing its BotEmailDefinition, owner, or flow re-routes them. A **new** address created in Step 1 is not live.
|
|
9
10
|
|
|
10
11
|
If the channel has no existing routing, skip this gate entirely and proceed directly to the branch.
|
|
11
12
|
|
|
@@ -41,10 +42,11 @@ If `AskUserQuestion` returns without a clear selection — timeout, empty answer
|
|
|
41
42
|
|
|
42
43
|
## If the user chooses "Set up, then wire manually"
|
|
43
44
|
|
|
44
|
-
Set `DEFER_INBOUND_ROUTING=true` and continue:
|
|
45
|
+
Set `DEFER_INBOUND_ROUTING=true` and continue. Steps that create new, unbound components still run; every step that points the live channel or routing address at the agent is skipped:
|
|
45
46
|
|
|
46
|
-
- **Branch A:** create the queue normally. Skip the `sf project deploy start` for the MessagingChannel
|
|
47
|
-
- **
|
|
47
|
+
- **Branch A:** create the queue normally. Skip Steps 3–5: (1) the `sf project deploy start` for the MessagingChannel, (2) the Data API PATCH that binds `SessionHandlerId`/`FallbackQueueId` on the channel, and (3) the verify that expects them set.
|
|
48
|
+
- **Branch B:** create the queue and write + deploy the RoutingFlow normally (the flow is safe to deploy — it only becomes live when assigned to the channel). Skip `channel-branch-voice.md` Step 4, the MessagingChannel deploy that assigns the flow to the channel.
|
|
49
|
+
- **Branch C:** create the queue, write + deploy the RoutingFlow (Omni-Channel path), and deploy the BotEmailDefinition (Step 4c) normally; none takes effect until a routing address references it. Skip: (1) the Step 4d Settings:Case metadata deploy that binds `botEmailDefinition`, `caseOwner`, or `routingFlow` on the routing address, and (2) any direct Tooling API PATCH that sets those fields on the target address.
|
|
48
50
|
|
|
49
51
|
After Phase 2 completes, if `DEFER_INBOUND_ROUTING=true`, print manual wiring instructions before the Phase 3 prompt.
|
|
50
52
|
|
|
@@ -81,6 +83,10 @@ sf data query -o {ORG} --json \
|
|
|
81
83
|
-q "SELECT SessionHandlerId, FallbackQueueId FROM MessagingChannel WHERE Id='${CHAN_ID}'"
|
|
82
84
|
```
|
|
83
85
|
|
|
84
|
-
###
|
|
86
|
+
### Branch B — activate when ready
|
|
85
87
|
|
|
86
|
-
> The RoutingFlow `{FLOW_DEVELOPER_NAME}` is deployed and active. To assign it as the inbound routing flow,
|
|
88
|
+
> The RoutingFlow `{FLOW_DEVELOPER_NAME}` is deployed and active. To assign it as the inbound routing flow, run `channel-branch-voice.md` Step 4 (the MessagingChannel deploy that sets `sessionHandlerFlow`) — or re-run this skill against the same channel; the existing flow will be detected and reused, and only the channel assignment step will run.
|
|
89
|
+
|
|
90
|
+
### Branch C — activate when ready
|
|
91
|
+
|
|
92
|
+
> The BotEmailDefinition `{BOT_EMAIL_DEFINITION_NAME}` (and, on the Omni-Channel path, the RoutingFlow `{INBOUND_FLOW_DEVELOPER_NAME}`) is deployed but not yet bound to `{SUPPORT_EMAIL}`. To cut over, run `channel-branch-email.md` Step 4d against that address. Re-read CaseSettings first, because addresses may have changed since setup, and carry every other address over exactly as read.
|
|
@@ -15,7 +15,7 @@ sf data query --target-org $ORG --json \
|
|
|
15
15
|
|
|
16
16
|
## Step 2 — Present to user via AskUserQuestion
|
|
17
17
|
|
|
18
|
-
- **One or more found** → present each as an option: `{Queue.Name} ({Queue.DeveloperName})`, plus a final option *"Create a new queue"*. If the user picks an existing queue, capture its `DeveloperName
|
|
18
|
+
- **One or more found** → present each as an option: `{Queue.Name} ({Queue.DeveloperName})`, plus a final option *"Create a new queue"*. If the user picks an existing queue, capture its `Name`, `DeveloperName`, and `Id` as `QUEUE_NAME`, `QUEUE_DEVELOPER_NAME`, and `QUEUE_ID`, validate all three per [input-validation.md](input-validation.md), and skip queue creation. If one fails its grammar, don't use that queue; offer to create a new one.
|
|
19
19
|
- **Zero found** → inform the user no compatible queue exists; proceed directly to create one.
|
|
20
20
|
|
|
21
21
|
## Step 3 — Create a new queue (if needed)
|
|
@@ -46,6 +46,8 @@ sf data create record --target-org $ORG \
|
|
|
46
46
|
```bash
|
|
47
47
|
ORG_USERNAME=$(sf org display --target-org $ORG --json \
|
|
48
48
|
| python3 -c "import sys,json; print(json.load(sys.stdin)['result']['username'])")
|
|
49
|
+
UNAME_RE='^[A-Za-z0-9][A-Za-z0-9._@+-]*$'
|
|
50
|
+
[[ "$ORG_USERNAME" =~ $UNAME_RE ]] || { echo "Org username '$ORG_USERNAME' fails the ORG_USERNAME grammar. Stopping."; exit 1; }
|
|
49
51
|
RUNNING_USER_ID=$(sf data query --target-org $ORG --json \
|
|
50
52
|
--query "SELECT Id FROM User WHERE Username='$ORG_USERNAME'" \
|
|
51
53
|
| python3 -c "import sys,json; print(json.load(sys.stdin)['result']['records'][0]['Id'])")
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Input validation (before any command)
|
|
2
|
+
|
|
3
|
+
Every `{PLACEHOLDER}` in this skill's commands is pasted, unescaped, into a shell string, a SOQL literal, or metadata XML. A stray `'`, `;`, `$(...)`, or `<` in a value would rewrite the command or the deployed file. Check each value against its grammar before the first command that uses it. This covers values the user types and values read back from the org (Ids, `Address`, `Queue.Name`, the org's username and API version).
|
|
4
|
+
|
|
5
|
+
On a mismatch, stop and ask the user for a corrected value. Never escape and continue: an escaped value that reaches the org is still not the name the user meant. For a value read back from the org, say which record failed; when adopting an existing queue, offer to create a new one instead.
|
|
6
|
+
|
|
7
|
+
| Value | Grammar |
|
|
8
|
+
|---|---|
|
|
9
|
+
| DeveloperName / API name: `AGENT_DEVELOPER_NAME`, `CHANNEL_DEVELOPER_NAME`, `QUEUE_DEVELOPER_NAME`, and every flow or `BotEmailDefinition` name | `^[A-Za-z][A-Za-z0-9_]{0,79}$` |
|
|
10
|
+
| Record Id: `BOT_ID`, `BOT_USER_ID`, `CHAN_ID`, `QUEUE_ID`, `ROUTING_ADDRESS_ID`, `CASE_SETTINGS_ID` | `^[A-Za-z0-9]{15}([A-Za-z0-9]{3})?$` |
|
|
11
|
+
| Queue label: `QUEUE_NAME` (typed, or an existing queue's `Name`) | `^[A-Za-z0-9][A-Za-z0-9 _.-]{0,79}$` |
|
|
12
|
+
| `CAPACITY_PERCENTAGE` | `^[0-9]{1,3}$` (an integer from the `queue-resolution.md` table) |
|
|
13
|
+
| `ORG_API_VERSION` | `^[0-9]{2}\.[0-9]$` |
|
|
14
|
+
| `SUPPORT_EMAIL` | `^[A-Za-z0-9][A-Za-z0-9._%+-]*@[A-Za-z0-9][A-Za-z0-9.-]*\.[A-Za-z]{2,}$` |
|
|
15
|
+
| `ORG` (alias or username), `ORG_USERNAME` | `^[A-Za-z0-9][A-Za-z0-9._@+-]*$` |
|
|
16
|
+
|
|
17
|
+
None of these grammars admits a quote, `;`, `$`, backtick, `|`, `&`, `<`, or `>`, and none lets a value start with `-`, so a matching value can't escape its shell, SOQL, `sed`, or XML context or be read as a CLI option. Only `QUEUE_NAME` admits a space, and every command quotes it.
|
|
18
|
+
|
|
19
|
+
`ORG_USERNAME` and `ORG_API_VERSION` are captured into a shell variable and used in the same block, so their commands check the grammar inline with `[[ ... =~ ... ]]` before first use.
|
|
20
|
+
|
|
21
|
+
## Free text
|
|
22
|
+
|
|
23
|
+
Values with no grammar above can't be passed through the shell: labels other than `QUEUE_NAME`, `legalDisclaimer`, `signature`, `routingName`, escalation messages, and the bot user's username (`BOT_USER_USERNAME`). Write them into the metadata file with the Edit/Write tools, XML-escaping `&` → `&`, `<` → `<`, `>` → `>`, `"` → `"`, and `'` → `'`. A value that must reach a shell command needs a grammar in the table first.
|