@salesforce/afv-skills 1.31.0 → 1.32.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/agentforce-bot-upgrade/SKILL.md +217 -0
- package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +242 -0
- package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +128 -0
- package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +208 -0
- package/skills/agentforce-bot-upgrade/references/input-contract.md +101 -0
- package/skills/agentforce-bot-upgrade/references/mapping-rules.md +113 -0
- package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +78 -0
- package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +67 -0
- package/skills/agentforce-bot-upgrade/references/quality-checklist.md +33 -0
- package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +116 -0
- package/skills/dx-devops-work-item-manage/SKILL.md +270 -0
- package/skills/dx-devops-work-item-manage/examples/common-workflows.md +479 -0
- package/skills/dx-devops-work-item-manage/references/cli-commands.md +476 -0
- package/skills/dx-org-manage/SKILL.md +8 -5
- package/skills/dx-org-trial-expiration-check/SKILL.md +239 -0
- package/skills/dx-org-trial-expiration-check/scripts/check_expiration.sh +588 -0
- package/skills/experience-ui-bundle-app-coordinate/SKILL.md +12 -9
- package/skills/experience-ui-bundle-custom-app-generate/SKILL.md +29 -5
- package/skills/experience-ui-bundle-custom-app-generate/references/configure-metadata-custom-application.md +1 -1
- package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.sh +30 -0
- package/skills/experience-ui-bundle-features-generate/SKILL.md +86 -11
- package/skills/experience-ui-bundle-features-generate/references/conflict-resolution-schema.json +20 -0
- package/skills/experience-ui-bundle-features-generate/scripts/verify-react-bundle.sh +14 -0
- package/skills/experience-ui-bundle-frontend-generate/SKILL.md +6 -1
- package/skills/experience-ui-bundle-frontend-generate/references/component.md +34 -1
- package/skills/experience-ui-bundle-frontend-generate/references/page.md +1 -1
- package/skills/experience-ui-bundle-project-generate/SKILL.md +111 -0
- package/skills/experience-ui-bundle-project-generate/scripts/flatten-project.mjs +33 -0
- package/skills/platform-custom-lightning-type-generate/SKILL.md +9 -14
- package/skills/platform-custom-lightning-type-generate/references/widget-rendition.md +27 -111
- package/skills/platform-lightning-type-widget-coordinate/SKILL.md +214 -0
- package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +80 -0
- package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +75 -0
- package/skills/platform-lightning-type-widget-coordinate/references/build-plan-format.md +67 -0
- package/skills/platform-lightning-type-widget-coordinate/references/lightning-type-discovery.md +124 -0
- package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +130 -0
- package/skills/platform-sharing-owd-configure/SKILL.md +142 -0
- package/skills/platform-sharing-owd-configure/examples/get_owd_output.md +38 -0
- package/skills/platform-sharing-owd-configure/examples/update_owd_output.md +44 -0
- package/skills/platform-sharing-owd-configure/references/access_levels.md +49 -0
- package/skills/platform-sharing-owd-configure/references/metadata_api_approach.md +69 -0
- package/skills/platform-sharing-rules-generate/SKILL.md +89 -19
- package/skills/platform-sharing-rules-generate/examples/test-cases.md +381 -0
- package/skills/platform-widget-generate/SKILL.md +241 -0
- package/skills/platform-widget-generate/examples/conditional.json +73 -0
- package/skills/platform-widget-generate/examples/list-with-foreach.json +66 -0
- package/skills/platform-widget-generate/examples/single-object.json +64 -0
- package/skills/platform-widget-generate/references/schema-from-lightning-type.md +76 -0
- package/skills/platform-widget-generate/references/widget-bundle-layout.md +116 -0
- package/skills/platform-widget-generate/references/widget-meta-directives.md +130 -0
- package/skills/sales-agentforce-pipeline-management-configure/SKILL.md +268 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/field-completion-template.genAiPromptTemplate-meta.xml +141 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/pipeline_management_flow.flow-meta.xml +548 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/sales_management_agent.agent +2938 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/sales_management_agent.bundle-meta.xml +4 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/sfdx-project.json +12 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/bant.txt +11 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/meddic.txt +11 -0
- package/skills/sales-agentforce-pipeline-management-configure/assets/stage-descriptions/spiced.txt +11 -0
- package/skills/sales-agentforce-pipeline-management-configure/examples/custom-prompt-instructions.md +317 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/admin-communication.md +355 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/agent-creation.md +383 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/auth-and-cli.md +146 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/automation-matrix.md +23 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/autonomous-updates.md +215 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/canonical-agent-path.md +75 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/data-sources.md +155 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/field-completion-prompt-template.md +120 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/field-completion-prompts.md +149 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/flags.md +13 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/flow-clone-from-template.md +447 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/metadata-inventory.md +330 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/opportunity-stages.md +246 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/repair-diagnostics.md +265 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/setup-order.md +263 -0
- package/skills/sales-agentforce-pipeline-management-configure/references/soap-api-enablement.md +528 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/CHANGES.md +180 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/README.md +56 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/add-field-suggestion.sh +679 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/create-agent.sh +302 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/create-flow.sh +250 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/define-agent-access.sh +430 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/deploy-settings.sh +77 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/enable-deal-agent.sh +241 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/enable-prerequisites.sh +538 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/flow-debug-and-verify.sh +385 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/retrieve-settings.sh +131 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/setup-all.sh +2791 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/agent-bundle-publish.sh +189 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/agent-detection.sh +239 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/flow-builder.sh +238 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/psg.sh +48 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/soap.sh +140 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/stage-descriptions.sh +448 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/shared/test-opp.sh +166 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/verify-all.sh +636 -0
- package/skills/sales-agentforce-pipeline-management-configure/scripts/verify-prompt-generation.sh +346 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Widget Meta Directives Reference
|
|
2
|
+
|
|
3
|
+
The `meta` object on a UEM block carries runtime directives for iteration (`forEach` / `forItem`) and conditional rendering (`if`). Read this file when a widget needs either.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Iteration with forEach / forItem
|
|
8
|
+
|
|
9
|
+
`forEach` iterates over an array; the block and ALL its children repeat for each item.
|
|
10
|
+
|
|
11
|
+
### Rules
|
|
12
|
+
|
|
13
|
+
- Place `forEach` on the `meta` object of the REPEATING block (e.g. a row or card).
|
|
14
|
+
- The value is an expression referencing an array: `{!$attrs.<arrayAttr>}` (or `{!$<outerForItem>.<arrayField>}` for nested loops).
|
|
15
|
+
- `forItem` is required alongside `forEach`. It names the variable bound to the current item and must start with `$`.
|
|
16
|
+
- Inside the `forEach` block, reach the **current item** through the loop variable (`{!$item.X}`) — not by traversing the array path (`{!$attrs.items.X}`, which does not unfold to the current iteration). Top-level references for values that don't change across iterations (`{!$attrs.<unrelatedField>}`) are still valid.
|
|
17
|
+
- `forEach` blocks can be nested — inner loops use their own `forItem` name.
|
|
18
|
+
|
|
19
|
+
### Example — top-level list
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"definition": "namespace/repeatingBlock",
|
|
24
|
+
"meta": { "forEach": "{!$attrs.items}", "forItem": "$item" },
|
|
25
|
+
"children": [
|
|
26
|
+
{ "definition": "namespace/childBlock1", "attributes": { "content": "{!$item.id}" } },
|
|
27
|
+
{ "definition": "namespace/childBlock2", "attributes": { "content": "{!$item.total}" } }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Example — container holds repeating child
|
|
33
|
+
|
|
34
|
+
When a container holds repeating items, `forEach` goes on the child — not on the container.
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"definition": "namespace/block",
|
|
39
|
+
"children": [
|
|
40
|
+
{
|
|
41
|
+
"definition": "namespace/repeatingBlock",
|
|
42
|
+
"meta": { "forEach": "{!$attrs.items}", "forItem": "$item" },
|
|
43
|
+
"children": [
|
|
44
|
+
{ "definition": "namespace/childBlock", "attributes": { "content": "{!$item.name}" } }
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Example — nested loops
|
|
52
|
+
|
|
53
|
+
The inner `forEach` references an array on the outer loop variable and uses a distinct `forItem` name.
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"definition": "namespace/repeatingBlock",
|
|
58
|
+
"meta": { "forEach": "{!$attrs.orders}", "forItem": "$order" },
|
|
59
|
+
"children": [
|
|
60
|
+
{ "definition": "namespace/childBlock", "attributes": { "content": "{!$order.id}" } },
|
|
61
|
+
{
|
|
62
|
+
"definition": "namespace/repeatingChildBlock",
|
|
63
|
+
"meta": { "forEach": "{!$order.lineItems}", "forItem": "$line" },
|
|
64
|
+
"children": [
|
|
65
|
+
{ "definition": "namespace/childBlock1", "attributes": { "content": "{!$line.name}" } },
|
|
66
|
+
{ "definition": "namespace/childBlock2", "attributes": { "content": "{!$line.count}" } }
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Conditional rendering with if
|
|
76
|
+
|
|
77
|
+
`if` conditionally renders a block. When the expression is `false`, the block and all its children are excluded from the rendered output.
|
|
78
|
+
|
|
79
|
+
### Rules
|
|
80
|
+
|
|
81
|
+
- Place `if` on the `meta` object of the block.
|
|
82
|
+
- Use `if` only when the schema has a `lightning__booleanType` property suited to the condition. Bind directly to that property (or to a loop variable holding such a value). If no suitable boolean exists in the schema, do not use `if` — render the block unconditionally instead.
|
|
83
|
+
- Do not lean on the truthiness of strings (`""` vs `"value"`), numbers (`0` vs `1`), or nullable fields — that may render today but is not guaranteed across surfaces. Comparisons, arithmetic, and string operations are not supported.
|
|
84
|
+
- `if` may coexist with `forEach` on the same `meta`. `if` is evaluated first — if `false`, the loop is skipped entirely.
|
|
85
|
+
|
|
86
|
+
### Example — top-level boolean
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"definition": "namespace/block",
|
|
91
|
+
"meta": { "if": "{!$attrs.isVerified}" },
|
|
92
|
+
"attributes": { "label": "Verified user" }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Example — boolean nested inside a schema object
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"definition": "namespace/block",
|
|
101
|
+
"meta": { "if": "{!$attrs.features.showBanner}" },
|
|
102
|
+
"attributes": { "text": "Promo banner" }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Example — boolean inside a forEach loop
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"definition": "namespace/repeatingBlock",
|
|
111
|
+
"meta": { "forEach": "{!$attrs.tasks}", "forItem": "$task" },
|
|
112
|
+
"children": [
|
|
113
|
+
{ "definition": "namespace/block1", "attributes": { "content": "{!$task.title}" } },
|
|
114
|
+
{
|
|
115
|
+
"definition": "namespace/block2",
|
|
116
|
+
"meta": { "if": "{!$task.completed}" },
|
|
117
|
+
"attributes": { "label": "Done" }
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Gotchas
|
|
126
|
+
|
|
127
|
+
| Issue | Resolution |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `if` bound to a non-boolean (string or number) does not behave as expected | Use `if` only when the schema has a `lightning__booleanType` property; otherwise render the block unconditionally |
|
|
130
|
+
| Nested loops share the same `forItem` name | Pick distinct names (e.g. `$item` outer, `$line` inner) — there is no validation error on collision |
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sales-agentforce-pipeline-management-configure
|
|
3
|
+
description: "Use to configure, set up, or repair the Sales Management agent and Agentforce Pipeline Management in a Salesforce org. Automates metadata creation for flows, prompt templates, permission sets, and data source configuration. TRIGGER when: user wants to enable Pipeline Management, configure Sales pipeline features, set up the Sales Management agent for opportunity field updates (including autonomous updates), connect enabled data sources like Einstein Conversation Insights or Einstein Activity Capture, customize opportunity stage descriptions, configure post-meeting suggestions, verify or audit configuration status, fix partially configured orgs, or troubleshoot Pipeline Management metadata issues. DO NOT TRIGGER when: user wants to build a custom agent (use agentforce-generate), configure general Agentforce tracing (use platform-tracing-agentforce-configure), work with non-Sales agents, or enable Einstein Conversation Insights or Einstein Activity Capture from scratch (provisioning is out of scope)."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
minApiVersion: "64.0"
|
|
7
|
+
relatedSkills:
|
|
8
|
+
- "agentforce-generate"
|
|
9
|
+
- "platform-tracing-agentforce-configure"
|
|
10
|
+
cliTools:
|
|
11
|
+
- tool: ["curl"]
|
|
12
|
+
semver: ">=7.0.0"
|
|
13
|
+
- tool: ["jq"]
|
|
14
|
+
semver: ">=1.6.0"
|
|
15
|
+
- tool: ["sf"]
|
|
16
|
+
semver: ">=2.139.6"
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Agentforce Pipeline Management Configuration
|
|
20
|
+
|
|
21
|
+
Configure Agentforce Pipeline Management end-to-end in a Salesforce org. This skill handles both greenfield orgs (zero configuration) and partially configured orgs that need repair or completion.
|
|
22
|
+
|
|
23
|
+
## Scope
|
|
24
|
+
|
|
25
|
+
- **In scope**: Enabling Pipeline Management, configuring the Sales Management agent, activating/customizing flows (Process Field Update Suggestions, Get Opportunity Grounding Data, Get AI Recommendations from Call Transcripts), prompt template configuration, permission set assignment, data source setup, opportunity stage descriptions, autonomous field update configuration, and partial-org repair.
|
|
26
|
+
- **Out of scope**: Building custom agents from scratch (use `agentforce-generate`). Einstein Conversation Insights or Einstein Activity Capture initial provisioning (those are separate products). Slack app installation. Custom Apex triggers on Opportunity Team Member.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
|
|
32
|
+
### You must verify (scripts cannot check or change these)
|
|
33
|
+
|
|
34
|
+
1. **Edition**: Enterprise, Performance, Unlimited, or Developer Edition with Agentforce for Sales add-on (or Agentforce 1 Sales Edition). Setup **probes** this up front (Step 0) — it fails fast with a license/edition message on an org that can't run Pipeline Management, before asking anything — but edition/license provisioning itself is still admin-owned.
|
|
35
|
+
2. **User permissions**: The executing user needs `View Setup` AND (`Modify All Data` OR `Customize Application`), `Manage AI Agents` AND (`Manage Agentforce Employee Agents` OR `Customize Application`), and `Assign Permission Sets`.
|
|
36
|
+
|
|
37
|
+
### Enabled automatically by `scripts/setup-all.sh`
|
|
38
|
+
|
|
39
|
+
The following settings are toggled by setup automatically — do not enable them manually before running the script.
|
|
40
|
+
|
|
41
|
+
- **Einstein Generative AI** (`EinsteinGptSettings.enableEinsteinGptPlatform`) — **required**; must be on before Agentforce Agent.
|
|
42
|
+
- **Agentforce Agent** (`EinsteinCopilotSettings.enableEinsteinGptCopilot`) — **required**; depends on Einstein Generative AI.
|
|
43
|
+
- **Agentforce Studio / Agent Platform** (`AgentPlatformSettings.enableAgentPlatform`) — **required**; depends on Agentforce Agent and gates the Deal Agent. Core rejects `SalesDealAgentSettings.enableDealAgent` when this is off, surfacing as an opaque Deal Agent activation failure.
|
|
44
|
+
- **Enhanced Notes** (`EnhancedNotesSettings.enableEnhancedNotes`) — **required**; Pipeline Management uses ContentNote as a primary data source.
|
|
45
|
+
- **Opportunity Team** (`OpportunitySettings.enableOpportunityTeam`) — **required**; the suggestion flow uses OpportunityTeamMember and will fail deployment without it.
|
|
46
|
+
- **Pipeline Inspection** (`OpportunitySettings.enablePipelineInspection`) — **required**; provides the UI where reps view and accept/dismiss suggestions. Suggestions still generate without it, but users have nowhere to see them.
|
|
47
|
+
- **Enhanced Email** (`EmailAdministrationSettings.enableEnhancedEmailEnabled`) — **optional but recommended**; only needed for email-body indexing when Einstein Activity Capture is in use.
|
|
48
|
+
- **Pipeline Management** (`SalesDealAgentSettings.enableDealAgent`) — **required**; the feature itself.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Clarifying Questions
|
|
53
|
+
|
|
54
|
+
> **Run the license preflight FIRST — before asking any of these questions.** As
|
|
55
|
+
> your very first action (right after resolving the org alias), run
|
|
56
|
+
> `bash scripts/setup-all.sh <org-alias> --check-license`. It runs only auth + the
|
|
57
|
+
> capability gate, asks nothing, and changes nothing. **If it exits non-zero**,
|
|
58
|
+
> relay the printed license/edition blocker to the user and **STOP** — do not ask
|
|
59
|
+
> any clarifying question and make no changes. Only when it exits 0 (org is
|
|
60
|
+
> capable — greenfield or already provisioned) proceed to the questions below.
|
|
61
|
+
|
|
62
|
+
Once the preflight passes, determine:
|
|
63
|
+
|
|
64
|
+
1. **Greenfield or repair?** Is this a new org that has never had Pipeline Management, or one with partial configuration?
|
|
65
|
+
2. **Data sources**: Which data sources should inform the agent?
|
|
66
|
+
- Notes (enabled by default)
|
|
67
|
+
- Emails (requires Einstein Activity Capture)
|
|
68
|
+
- Voice/Video calls (requires Einstein Conversation Insights)
|
|
69
|
+
- Enhanced Email (for email body indexing — requires `EmailAdministrationSettings.enableEnhancedEmailEnabled`)
|
|
70
|
+
3. **Autonomous updates**: Should the agent update opportunity fields autonomously, or only suggest updates for user review?
|
|
71
|
+
4. **Which fields should the agent manage? (ask this FIRST, up front — setup is field-selection-driven).** `setup-all.sh` builds the flow with **only the fields you select**, from the start — there is no deploy-both-then-strip step. Ask: *"Which Opportunity fields should the agent suggest values for? The OOTB options are Next Step (`NextStep`) and Opportunity Stage (`StageName`); you can also add custom text fields (e.g. a Competitor Analysis field)."*
|
|
72
|
+
- **At least 1 field is REQUIRED** — setup aborts (exit 1) if zero fields are selected. There is **no** default to `NextStep`.
|
|
73
|
+
- **Hard cap: 5 fields total**; OOTB fields count toward it. Selecting more aborts before any change.
|
|
74
|
+
- Pass the set with `--fields "NextStep,StageName,Risk__c"` in non-interactive runs, or type it at the interactive prompt.
|
|
75
|
+
5. **Per-field prompt customization (all fields EXCEPT `StageName`).** For each selected non-`StageName` field, setup collects an optional **goal** ("You must think about…") and **instruction** (extraction guidance):
|
|
76
|
+
- **`NextStep`** ships with a curated OOTB managed prompt. Setup only overrides it when you supply a goal/instruction (interactive: it asks whether to customize; non-interactive: pass `--field-goal "NextStep:…"` / `--field-instruction "NextStep:…"`). Skip customization to keep the OOTB prompt.
|
|
77
|
+
- **Custom fields** always get a goal/instruction (your text, or the script's sensible defaults).
|
|
78
|
+
- **`StageName` is NOT customizable** — it is a managed picklist template with no override support; setup never prompts for it.
|
|
79
|
+
6. **Custom field eligibility**: Only standard or custom **text** fields on Opportunity are supported — plain Text (`type=string`) or Text Area ≤ 255 (`type=textarea`, `htmlFormatted=false`); length ≤ 255; not Long Text Area (length > 255), Rich Text Area (`htmlFormatted=true`), picklist, or formula. The suggestion is capped at the field's own length. Fields selected in question 4 are wired during `setup-all.sh`; **additional** fields added *after* setup use `scripts/add-field-suggestion.sh <org-alias> <FieldApiName>` (one per field; see Phase 4.3). Both paths enforce the 5-total cap — `add-field-suggestion.sh` refuses to wire a 6th field.
|
|
80
|
+
7. **Opportunity stages**: Opportunity stages are picklist values, and different Opportunity record types may expose different stage subsets. Are standard or custom opportunity stages in use? Do their descriptions need to be defined/updated? Note: `OpptStageDescription` is **global-per-stage** — keyed only by `OpportunityStageApiName`, with no per-record-type column — so a description is written **once per active stage** and applies across every record type that exposes that stage. Setup works the same whether or not the org has Opportunity record types.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Admin Communication Guidelines
|
|
85
|
+
|
|
86
|
+
**CRITICAL**: This skill serves admin users, not developers. Follow these rules:
|
|
87
|
+
|
|
88
|
+
1. **Run all bash commands in background** (`run_in_background: true`) - this includes the main setup commands AND any log-tailing for progress monitoring
|
|
89
|
+
2. **Monitor progress without showing commands** - You can tail logs to provide progress updates, but run tail commands in background too. Parse the output and show only friendly updates like "✓ Opportunity Team: enabled". Never show the tail command itself or raw log lines.
|
|
90
|
+
3. **Investigate errors silently** - When something fails, do your diagnosis (check data, run queries, fix environment issues) in background without narrating each step. Only surface the conclusion and action: "I need to create a test opportunity first. Let me do that..." NOT "The --json output is corrupted... let me check... ANSI color codes... let me fix..."
|
|
91
|
+
4. **Narrate in plain language**: Say "Setting up the platform..." NOT "Running setup-all.sh Phase 1.5"
|
|
92
|
+
5. **Hide technical details**: No SOAP responses, curl commands, jq parsing, phase numbers, or script paths unless user asks to debug
|
|
93
|
+
6. **Check exit codes**: Always parse success/failure and translate technical errors to admin-friendly messages
|
|
94
|
+
7. **Set time expectations**: "This takes ~3 minutes..." prevents "is it frozen?" questions
|
|
95
|
+
8. **Handle errors gracefully**: Auto-retry transient failures; explain and offer choices for real blockers
|
|
96
|
+
|
|
97
|
+
See `references/admin-communication.md` for detailed error translation patterns, examples, and recovery strategies.
|
|
98
|
+
|
|
99
|
+
## Workflow
|
|
100
|
+
|
|
101
|
+
**IMPORTANT — Primary Entry Point**: For end-to-end setup, drive `scripts/setup-all.sh`. It handles all prerequisites, enablement, flow deployment, permissions, and verification in the correct dependency order. Only use individual scripts when diagnosing or repairing specific components after `setup-all.sh` has run.
|
|
102
|
+
|
|
103
|
+
`setup-all.sh` is a **3-phase, field-selection-driven** setup: (1) platform enablement + agent user + PSG assignment; (2) field selection → prompt template creation/activation → stage descriptions (only if `StageName` selected) → prompt verification; (3) flow build (selected fields only), flow activation, agent activation, PSG recalc. It is **safe by default**: suggestions-only mode, no stage-description creation unless asked, and the flow does not go live until the prompts are in place.
|
|
104
|
+
|
|
105
|
+
#### Canonical agent path — two calls with an interactive tune-loop between them
|
|
106
|
+
|
|
107
|
+
See `references/canonical-agent-path.md` for the full two-call pattern with code examples, agent rules, narration templates, and internal step map.
|
|
108
|
+
|
|
109
|
+
**Summary**: Split setup into Call 1 (`--through-phase prompts`) and Call 2 (`--from-phase flow`) with a tune-loop between them where you drive prompt approval per field. Call 2 is MANDATORY — without it no flow exists and no suggestions generate.
|
|
110
|
+
|
|
111
|
+
#### Unattended / CI path (single call, no tune-loop)
|
|
112
|
+
|
|
113
|
+
For fully unattended runs (cron/CI, or when the user explicitly declines prompt review):
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
bash setup-all.sh <org-alias> --fields "NextStep,StageName,Risk__c" \
|
|
117
|
+
[--field-goal "NextStep:<text>"] [--field-instruction "NextStep:<text>"] \
|
|
118
|
+
[--autonomous] [--create-stage-descriptions] [--skip-prompt-verification] \
|
|
119
|
+
--non-interactive [--users "a@x.com,b@x.com"]
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
In single-pass mode the verification step still prints each field's suggestion (informational). Relay them to the user.
|
|
123
|
+
|
|
124
|
+
#### Flags
|
|
125
|
+
|
|
126
|
+
See `references/flags.md` for complete flag documentation. Key flags:
|
|
127
|
+
|
|
128
|
+
- `--check-license` — preflight only (exit 0 = capable, 1 = blocker). Run FIRST.
|
|
129
|
+
- `--through-phase prompts` / `--from-phase flow` — split-run endpoints (mutually exclusive)
|
|
130
|
+
- `--fields "NextStep,StageName"` — required field set (at least 1, max 5)
|
|
131
|
+
- `--autonomous` — enable auto-apply mode (off by default)
|
|
132
|
+
- `--non-interactive` / `--yes` — unattended mode (requires `--fields`)
|
|
133
|
+
- `--users "a@x.com,b@x.com"` — explicit user list for PSG assignment (email-validated)
|
|
134
|
+
|
|
135
|
+
The phases below explain the decision logic for manual/repair scenarios. See `references/setup-order.md` for step-by-step details.
|
|
136
|
+
|
|
137
|
+
### Automation Summary
|
|
138
|
+
|
|
139
|
+
Every configuration step and whether it's CLI-automatable (and how) or UI-only lives in `references/automation-matrix.md`. In short: prerequisites, enablement, flow clone/activation, agent publish/activation, permissions, field suggestions, and stage descriptions are all CLI-automatable (`setup-all.sh` does them in dependency order); only Agent Analytics is UI-only.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### Phase 0 — Authentication and Org Assessment
|
|
144
|
+
|
|
145
|
+
1. **Authenticate** — See `references/auth-and-cli.md`. Always use `2>/dev/null` on `sf --json | jq`.
|
|
146
|
+
|
|
147
|
+
2. **Assess org state** — Branching signals (NOT PSG existence — PSGs ship with the license even in unconfigured orgs):
|
|
148
|
+
- **Enablement**: `SalesDealAgentSettings.enableDealAgent` via SOAP readMetadata
|
|
149
|
+
- **Setup-has-run** (any of): (a) agent user holds `SalesManagementAgentUserPsg`, (b) flow `Process_Field_Update_Suggestions` exists (by ApiName, not label), (c) `BotDefinition` with `AgentTemplate IN ('SalesMgmt__NGASalesAgent','SalesMgmt__SalesAgent')`
|
|
150
|
+
|
|
151
|
+
3. **Run `scripts/setup-all.sh <org-alias>`** — handles branching automatically:
|
|
152
|
+
- No enablement + no signals → greenfield (Phase 1)
|
|
153
|
+
- Partial signals → repair (Phase 3)
|
|
154
|
+
- All present → verification only
|
|
155
|
+
|
|
156
|
+
### Phase 1 — Enable Prerequisites and Pipeline Management
|
|
157
|
+
|
|
158
|
+
**See `references/setup-order.md` for complete scripts.** Enable in dependency order: Einstein GenAI → Agentforce Agent → Agent Platform → Enhanced Notes → Opportunity Team → Pipeline Management → Pipeline Inspection. Then deploy the flow (`scripts/create-flow.sh`) and verify agent architecture (`references/agent-creation.md`).
|
|
159
|
+
|
|
160
|
+
**What auto-creates on enablement**: agent user + PSGs (auto-assigned). **What you must create**: `BotDefinition:SalesAgent` (via authoring-bundle publish) and the schedule-triggered flow (via template deploy).
|
|
161
|
+
|
|
162
|
+
### Phase 2 — Assign Permissions
|
|
163
|
+
|
|
164
|
+
1. **Define Agent Access**: `bash scripts/define-agent-access.sh <org-alias>` — creates custom permset, links into both PSGs. See `references/agent-creation.md` → "Agent Access".
|
|
165
|
+
|
|
166
|
+
2. **Assign PSG to target users**: **HARD RULE — never bulk-assign.** Grant `SalesManagementUserPsg` only to: (1) the running user, and (2) explicit `--users` list. No enumerate-and-grant.
|
|
167
|
+
|
|
168
|
+
### Phase 3 — Repair Mode (Partially Configured Org)
|
|
169
|
+
|
|
170
|
+
See `references/repair-diagnostics.md` for the full checklist. Common issues: flow deactivated → Tooling API `PATCH`; agent not active → `sf agent activate`; prompt template inactive → version round-trip redeploy; agent missing → SOAP toggle off/on.
|
|
171
|
+
|
|
172
|
+
### Phase 4 — Customize (Admin Decisions Required)
|
|
173
|
+
|
|
174
|
+
1. **Define Opportunity Stage Descriptions** — Use the "propose and correct" pattern from `references/opportunity-stages.md`. Query active stages, present defaults from reference file, apply user corrections, bulk-create via Tooling API.
|
|
175
|
+
|
|
176
|
+
**IMPORTANT**: Stage descriptions MAY be auto-provisioned when Pipeline Management is enabled (test orgs showed MEDDIC descriptions pre-populated). **Always CHECK for existing descriptions BEFORE attempting to create them**. If descriptions already exist, UPDATE rather than CREATE to avoid duplicates.
|
|
177
|
+
|
|
178
|
+
2. **Configure additional data sources** — See `references/data-sources.md` for decision table (Einstein Conversation Insights, Einstein Activity Capture, Inbox).
|
|
179
|
+
|
|
180
|
+
3. **Add custom opportunity field suggestions (AFTER setup)** — Fields chosen at setup time are wired by `setup-all.sh --fields`. To add a **new** field to an already-configured org, run `scripts/add-field-suggestion.sh <org-alias> <FieldApiName>` (e.g. a `Risk__c` field). The script validates the field, fills the canonical template (`assets/field-completion-template.genAiPromptTemplate-meta.xml`), deploys and activates it via the version round-trip, and idempotently wires the field into the live `Process_Field_Update_Suggestions` flow (respecting the 5-field cap). Optional flags: `--label`, `--goal`, `--instruction` (the two field-specific prompt lines), `--verify-with-note` (seed a Note + run a synchronous generation), `--opp <Id>`, `--skip-flow`, `--force`. See `references/field-completion-prompts.md` for mechanics and `references/field-completion-prompt-template.md` for writing the goal/instruction lines.
|
|
181
|
+
|
|
182
|
+
> **Naming note**: the prompt-template `<type>` is `einstein_gpt__fieldCompletion` (used in all metadata — never change it). The **Setup UI** (Prompt Builder) labels this category **"Field Generation"** — same thing. Admins should look for "Field Generation", not "Field Completion".
|
|
183
|
+
|
|
184
|
+
4. **Configure autonomous updates** — Autonomous mode is a single **org-wide** toggle (`SalesDealAgentSettings.enableDealAgentAutoApproveAllTasks`), not a per-field setting: when ON, the agent auto-applies all field suggestions without review; when OFF (the default), every suggestion waits for human approval. It is opt-in via `setup-all.sh --autonomous`. See `references/autonomous-updates.md` for the toggle and safety considerations.
|
|
185
|
+
|
|
186
|
+
5. **Enable Agent Analytics** — Setup → Einstein Feedback and Monitoring → Agent Analytics (UI-only).
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Understanding the Flows
|
|
191
|
+
|
|
192
|
+
See `references/flow-clone-from-template.md` for complete flow architecture, clone approach, and technical constraints.
|
|
193
|
+
|
|
194
|
+
**Key facts**: Pipeline Management uses a schedule-triggered flow (`Process_Field_Update_Suggestions`) cloned from the managed template. Detection is by ApiName (not label). The flow calls `getOrExecFieldUpdtSuggestion` with the selected fields — adding a field requires both activating its template AND wiring it into the flow's collection (handled atomically by `add-field-suggestion.sh`). **No suggestions generate until this flow is active.**
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Key Considerations
|
|
199
|
+
|
|
200
|
+
- **Pipeline Management REQUIRES a standalone `BotDefinition:SalesAgent`** — a missing BotDefinition blocks setup. Auto-provisioning creates it in most editions, but where it doesn't, `publish_and_activate_agent()` (in `shared/agent-bundle-publish.sh`, called by `setup-all.sh` and `create-agent.sh`) publishes the bundle from `assets/sales_management_agent.agent` and activates it. Do NOT rely on the `EmployeeCopilotPlanner` fallback — users need the interactive chat surface.
|
|
201
|
+
- Flow runs only when agent is **active** with **Read/Write** on opportunities; agent joins as opportunity team member (watch for Apex triggers on OpportunityTeamMember)
|
|
202
|
+
- Daily limit: 8,000 LLM requests / ~4,000 opportunities. Suggestions expire after 30 days
|
|
203
|
+
- Stage template reads `OpptStageDescription` via `GetOpportunityStageDetailsInvocableAction` — **stage suggestions fail** if any active stage lacks a description
|
|
204
|
+
- **Do NOT use CLI Metadata deploy** for DealAgent enablement — SOAP API v64.0 only (CLI has silent failure mode)
|
|
205
|
+
- **Do NOT enable `BotSettings`/`enableBots`** — legacy messaging bots, unrelated, fails with "Legal Terms" error
|
|
206
|
+
- Pipeline Management does NOT use a managed package — components provisioned directly on enablement
|
|
207
|
+
- Toggle not visible in Setup → verify Sales Cloud EE+ license and Agentforce SKU
|
|
208
|
+
- Always use `2>/dev/null` on `sf ... --json` piped to jq (strips CLI warnings that corrupt JSON)
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## References
|
|
213
|
+
|
|
214
|
+
- `references/setup-order.md` — Complete copy-paste setup sequence with all scripts
|
|
215
|
+
- `references/soap-api-enablement.md` — SOAP API patterns for all prerequisites
|
|
216
|
+
- `references/flow-clone-from-template.md` — Flow clone approach with ApiName-based detection
|
|
217
|
+
- `references/agent-creation.md` — Agent creation (auto-provisioning + authoring-bundle publish; the SOAP toggle only re-provisions the agent user and PSGs, not the BotDefinition)
|
|
218
|
+
- `references/field-completion-prompts.md` — Adding custom field suggestions end-to-end (verified v67 pattern, the three requirements, `add-field-suggestion.sh` mechanics, verification)
|
|
219
|
+
- `references/field-completion-prompt-template.md` — Writing the field-specific goal/instruction lines the script consumes
|
|
220
|
+
- `references/opportunity-stages.md` — Stage descriptions + methodologies
|
|
221
|
+
- `references/repair-diagnostics.md` — Partially configured org handling
|
|
222
|
+
- `references/auth-and-cli.md` — Auth methods, CLI compatibility
|
|
223
|
+
- `references/data-sources.md` — Decision table for EAC/ECI/Notes/Enhanced Email
|
|
224
|
+
- `references/autonomous-updates.md` — Auto-apply mode toggle and safety considerations
|
|
225
|
+
- `references/metadata-inventory.md` — Complete inventory of provisioned metadata components
|
|
226
|
+
- `references/automation-matrix.md` — Which setup steps are CLI-automatable (and how) vs UI-only
|
|
227
|
+
- `references/admin-communication.md` — Admin-friendly narration patterns: error-translation table, silent-investigation examples, and per-step narration templates for driving setup conversationally
|
|
228
|
+
|
|
229
|
+
## Examples
|
|
230
|
+
|
|
231
|
+
- `examples/custom-prompt-instructions.md` — Custom prompt instruction patterns for methodology alignment and update aggressiveness control
|
|
232
|
+
|
|
233
|
+
## Standalone Scripts
|
|
234
|
+
|
|
235
|
+
Executable scripts for each setup phase (run from `scripts/` directory with `sfdx-project.json` in CWD):
|
|
236
|
+
|
|
237
|
+
- `scripts/setup-all.sh` — **Master orchestration**: 3-phase, field-selection-driven end-to-end setup (auth + enablement + agent user/PSG → field selection + prompt templates + stage descriptions + prompt-verification gate → flow build/activate + agent activate + PSG recalc). Requires `--fields` (aborts if none); interactive by default; safe defaults (suggestions-only, no stage-description creation) with `--field-goal`/`--field-instruction`, `--autonomous`, `--create-stage-descriptions`, `--skip-prompt-verification` opt-in flags and `--non-interactive`/`--yes` for unattended runs
|
|
238
|
+
- `scripts/shared/flow-builder.sh` — flow field-collection helpers sourced by `setup-all.sh`: `build_field_collection` (greenfield — writes a flow wiring only the selected fields), plus `strip_flow_field` / `add_flow_field` / `flow_wired_fields` (repair — reconcile an already-deployed flow's fields in place)
|
|
239
|
+
- `scripts/shared/stage-descriptions.sh` — Phase 4c.5 stage-description creation sourced by `setup-all.sh`; exports `run_stage_descriptions()` (self-gates on `STAGENAME_SELECTED`; sets `STAGE_DESCRIPTIONS_BLOCKED` for the Phase 8.5 summary)
|
|
240
|
+
- `scripts/shared/test-opp.sh` — shared test-opportunity + grounding-note resolution sourced by both verify scripts (`flow-debug-and-verify.sh`, `verify-prompt-generation.sh`); exports `resolve_test_opportunity` (reuse/create/fallback the `[PM-TEST]` test opp, roll CloseDate, seed/refresh the grounding note) and `seed_grounding_note`
|
|
241
|
+
- `scripts/retrieve-settings.sh` — Audit current org settings state
|
|
242
|
+
- `scripts/enable-prerequisites.sh` — Enable prerequisite **settings only** (Einstein GenAI, Agentforce, Enhanced Notes, Opportunity Team) via SOAP — no fields/flow/agent. `setup-all.sh` runs this same enablement inline; use the standalone script only for surgical, non-destructive prerequisite toggling
|
|
243
|
+
- `scripts/enable-deal-agent.sh` — Enable Pipeline Management via SOAP API (standalone helper; `setup-all.sh` enables PM inline — use this only for isolated manual toggling)
|
|
244
|
+
- `scripts/create-flow.sh` — Detect, deploy from template, or activate suggestion flow (falls back to UI guidance)
|
|
245
|
+
- `scripts/create-agent.sh` — Verify/create/activate agent (auto-provisioning + authoring-bundle publish; SOAP toggle only re-provisions agent user/PSGs, not the BotDefinition); also defines Agent Access on completion
|
|
246
|
+
- `scripts/define-agent-access.sh` — Define Agent Access so both users holding `SalesManagementUserPsg` and the autonomous agent user holding `SalesManagementAgentUserPsg` can launch/run the agent (custom permset + `SetupEntityAccess` + `PermissionSetGroupComponent` into both PSGs + recalc)
|
|
247
|
+
- `scripts/deploy-settings.sh` — Deploy non-SOAP settings (Notes, Email, Opportunity)
|
|
248
|
+
- `scripts/add-field-suggestion.sh` — Add an AI field-completion suggestion for any eligible Opportunity text field (validate → fill canonical template → deploy + activate via version round-trip → wire flow; `--verify-with-note` for synchronous generation)
|
|
249
|
+
- `scripts/verify-all.sh` — Comprehensive configuration status check (read-only)
|
|
250
|
+
|
|
251
|
+
## Admin Verification Tools
|
|
252
|
+
|
|
253
|
+
The following scripts help admins verify that Pipeline Management is working correctly after setup. Use these to confirm field suggestions are generating as expected.
|
|
254
|
+
|
|
255
|
+
**Before running either verify script, compose a realistic grounding note and pass it via the `PM_GROUNDING_NOTE` env var.** The AI only generates a suggestion when the opportunity's Note carries real sales context — a generic placeholder grounds on nothing and returns empty, making a working setup look broken. Write a few sentences of a plausible sales call/meeting reflecting the configured `--fields` and any `--field-goal`/`--field-instruction` (e.g. concrete next steps and deadlines for `NextStep`; buyer, budget, pain, and timeline signals for `StageName`). Do not use a rigid template — tailor it to what was configured. Example: `PM_GROUNDING_NOTE="Discovery call with the VP of Sales: confirmed a $250K budget and a Q3 go-live; agreed next steps are a technical deep-dive with IT and an ROI analysis." bash scripts/flow-debug-and-verify.sh <org>`. Absent the env var, the scripts fall back to a generic note.
|
|
256
|
+
|
|
257
|
+
**Both scripts are invoked separately by the skill but converge on the SAME test opportunity and the SAME grounding note.** They both find-or-create a user-owned opp named `[PM-TEST] Test Pipeline Verification Opp` (the `[PM-TEST]` prefix makes every opp this tooling creates findable via `Opportunity WHERE Name LIKE '[PM-TEST]%'`). On reuse they roll the opp's CloseDate +30 days so it stays flow-eligible, and refresh the grounding note only when the `PM_GROUNDING_NOTE` you pass differs from the stored one (otherwise the existing note is left untouched). Pass the same `PM_GROUNDING_NOTE` value to both invocations so the note is consistent regardless of run order.
|
|
258
|
+
|
|
259
|
+
- `scripts/flow-debug-and-verify.sh` — Guided two-phase verification of the scheduled suggestion flow.
|
|
260
|
+
- **flow-debug-start** (`bash scripts/flow-debug-and-verify.sh <org> [opp-id]`) reuses a stable user-owned test opportunity named `[PM-TEST] Test Pipeline Verification Opp` if one is still eligible (so repeated runs don't pile up duplicate opps), otherwise creates it, falls back to any user-owned open opp if creation fails, seeds/refreshes a grounding Note on whichever opp resolves, and prints the flow's **Debug** URL, the opportunity to select, and the exact `verify` command to run afterward — including a trailing baseline count (the pre-run suggestion count). It uses a user-owned opp so the resulting suggestion is visible in the admin's owner-scoped Pipeline Inspection. If no opportunity is available it prints an actionable message and exits 0 without verifying. Relay the URL + opportunity to the user and wait for them to run Debug in Flow Builder against that opportunity — this is the only on-demand path that binds a real `$Record` on a scheduled record-triggered flow (leave rollback mode UNCHECKED so the DML persists).
|
|
261
|
+
- **verify** (`bash scripts/flow-debug-and-verify.sh <org> <opp-id> verify [baseline]`) runs after the user confirms the debug run finished: it confirms the flow reached its action (agent user added to the Opportunity Team) and polls (~4 min) for the generated `AiGenActionItem` suggestions. **Pass the baseline that flow-debug-start printed** — it is captured *before* the debug run, so the delta is exact; omitting it falls back to weaker absolute detection. The wait between phases happens in the conversation, not inside the script.
|
|
262
|
+
- `scripts/verify-prompt-generation.sh` — Test the prompt template behind a field by calling the Einstein `/generations` API directly. Pass the **field** API name (`bash scripts/verify-prompt-generation.sh <org> <field> [opp-id]` — e.g. `NextStep`, `Risk__c`); it resolves the field to its managed/derived template (a bare, un-namespaced managed name returns `ENTITY_IS_DELETED`) and uses the same user-owned opp selection strategy as `flow-debug-and-verify.sh` (both share one sourced lib: reuse the shared `[PM-TEST] Test Pipeline Verification Opp` → create it → owner-scoped fallback → graceful skip) — the only difference on skip is that no Einstein endpoint call is made. Shows the actual suggestion text generated, helping admins validate custom prompt instructions.
|
|
263
|
+
|
|
264
|
+
## Agent Assets
|
|
265
|
+
|
|
266
|
+
- `assets/sales_management_agent.agent` — Agent Script definition for the Sales Management Agent (used when auto-provisioning fails)
|
|
267
|
+
- `assets/sales_management_agent.bundle-meta.xml` — AiAuthoringBundle metadata (deploy with `sf agent publish authoring-bundle --api-name SalesAgent`)
|
|
268
|
+
- `assets/field-completion-template.genAiPromptTemplate-meta.xml` — Canonical `einstein_gpt__fieldCompletion` prompt template with `@@PLACEHOLDERS@@`, filled in by `scripts/add-field-suggestion.sh` (do not deploy directly)
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!--
|
|
3
|
+
Canonical field-completion (type einstein_gpt__fieldCompletion) prompt template.
|
|
4
|
+
|
|
5
|
+
This is a TEMPLATE with @@PLACEHOLDERS@@ substituted by
|
|
6
|
+
scripts/add-field-suggestion.sh. Do not deploy this file directly.
|
|
7
|
+
|
|
8
|
+
Placeholders:
|
|
9
|
+
@@DEVNAME@@ - GenAiPromptTemplate developerName, e.g. RecommendRiskforOpp
|
|
10
|
+
@@MASTERLABEL@@ - human label, e.g. "Recommend Risk for Opportunity"
|
|
11
|
+
@@FIELD@@ - Opportunity field API name, e.g. Risk__c
|
|
12
|
+
@@FIELDLABEL@@ - field label, e.g. "Risk"
|
|
13
|
+
@@CHARCAP@@ - SuggestedNewValue max chars = the field's own length (<=255)
|
|
14
|
+
@@FIELD_GOAL@@ - one sentence: what to think about for this field
|
|
15
|
+
@@FIELD_INSTRUCTION@@ - one line: field-specific extraction guidance
|
|
16
|
+
|
|
17
|
+
Everything else is the OOTB Pipeline Management instruction body, VERBATIM.
|
|
18
|
+
Only the field name and the two field-specific lines above ever change.
|
|
19
|
+
|
|
20
|
+
Structure invariants (verified against a live org, do NOT alter):
|
|
21
|
+
- <type>einstein_gpt__fieldCompletion</type>
|
|
22
|
+
- input <apiName>RelatedEntity</apiName> is platform-fixed for Metadata-API
|
|
23
|
+
authored templates; the body resolves against <referenceName>Input:Opportunity</referenceName>
|
|
24
|
+
- body merge fields use {!$Input:Opportunity.<field>}
|
|
25
|
+
- <relatedField> is object-qualified: Opportunity.<field>
|
|
26
|
+
- a <templateDataProviders> block is REQUIRED because the body references
|
|
27
|
+
{!$Flow:sales_pipe_mgmt__GetOppGroundingData.Prompt}
|
|
28
|
+
- <status>Published</status>
|
|
29
|
+
- NO <versionIdentifier>/<activeVersionIdentifier> here; the deploy round-trip
|
|
30
|
+
in add-field-suggestion.sh adds them (deploy -> retrieve identifier -> set
|
|
31
|
+
active -> redeploy). Never hand-author or guess the identifier.
|
|
32
|
+
-->
|
|
33
|
+
<GenAiPromptTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
34
|
+
<description>Field generation prompt for the Opportunity @@FIELDLABEL@@ field</description>
|
|
35
|
+
<developerName>@@DEVNAME@@</developerName>
|
|
36
|
+
<masterLabel>@@MASTERLABEL@@</masterLabel>
|
|
37
|
+
<overridable>false</overridable>
|
|
38
|
+
<relatedEntity>Opportunity</relatedEntity>
|
|
39
|
+
<relatedField>Opportunity.@@FIELD@@</relatedField>
|
|
40
|
+
<templateVersions>
|
|
41
|
+
<content>You are an AI Assistant to a Sales Representative.
|
|
42
|
+
You must think about @@FIELD_GOAL@@
|
|
43
|
+
You must analyze all of the following data sources: call transcript, email, and content note and extract information in order to provide the suggested new value for the "@@FIELDLABEL@@" field of the opportunity, reasoning for the suggested new value, and snippets that capture the most important and relevant information from the data sources. @@FIELD_INSTRUCTION@@
|
|
44
|
+
The data may not be available in all the <DataSources> and you must strictly generate a SuggestedNewValue, Reasoning, DueDate, and Sources value based on whatever <DataSources> is available. You must strictly only generate an empty and zero values for the following keys: SuggestedNewValue, Reasoning, DueDate, and Sources if the call transcript, email, and content note within the <DataSources> are blank, empty, or contain a placeholder. You must convert all this information into a concise assessment.
|
|
45
|
+
The call transcript contains metadata, but you must strictly ignore all of this metadata, because you must only extract key insights from the actual conversation.
|
|
46
|
+
|
|
47
|
+
<DataSources>
|
|
48
|
+
"""
|
|
49
|
+
{!$Flow:sales_pipe_mgmt__GetOppGroundingData.Prompt}
|
|
50
|
+
"""
|
|
51
|
+
Opportunity Current @@FIELDLABEL@@ Value:
|
|
52
|
+
"""
|
|
53
|
+
{!$Input:Opportunity.@@FIELD@@}
|
|
54
|
+
"""
|
|
55
|
+
</DataSources>
|
|
56
|
+
|
|
57
|
+
When I ask you to generate Suggested New Value of the '@@FIELDLABEL@@' field, Reasoning, and Snippets, you must strictly follow my instructions below:
|
|
58
|
+
For the Suggested New Value of the '@@FIELDLABEL@@' field, here are your instructions:
|
|
59
|
+
"""
|
|
60
|
+
The "SuggestedNewValue" must be a maximum of @@CHARCAP@@ characters.
|
|
61
|
+
If dates and names are available, you must strictly include the relevant dates and the people associated with each item.
|
|
62
|
+
You must strictly not generate any content or information that you do not have any data or basis on.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
For the Reasoning, here are your instructions:
|
|
66
|
+
"""
|
|
67
|
+
Give a clear and concise explanation and make sure that the reasoning, suggested new value of the '@@FIELDLABEL@@' field, sources and snippets must directly support each other consistently and logically.
|
|
68
|
+
You must explicitly mention all the sources and snippets when you generate your reasoning.
|
|
69
|
+
If dates and names are available, you must strictly Include the relevant dates and the people associated with each item.
|
|
70
|
+
You must strictly avoid any redundancies in your reasoning.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
For the Snippets, here are your instructions:
|
|
74
|
+
"""
|
|
75
|
+
Each data source is clearly labelled and you must strictly review the data source label and the data within it and make sure that it strictly aligns.
|
|
76
|
+
You must strictly include the author, owner, or writer of the snippet, for example, you must always include the name of the author, owner, or writer at the beginning of the snippet.
|
|
77
|
+
The snippet must include direct quotes, specific phrases or sentences from the provided data source as supporting evidence. It must be concrete evidence that supports the reasoning.
|
|
78
|
+
You must consistently use the correct capitalization and spelling in your snippets and avoid any redundancies.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
The value for the "source" object must be the exact record ID extracted from the <DataSources>.
|
|
82
|
+
You must strictly extract the EmailMessageId for emails.
|
|
83
|
+
You must strictly extract the latestVideoOrVoiceCallRecordId for call transcripts.
|
|
84
|
+
You must strictly extract the latestContentNoteRecordId for content notes.
|
|
85
|
+
|
|
86
|
+
You must generate the output in JSON structure with the following keys: FieldName, SuggestedNewValue, OriginalValue,Reasoning, DueDate, and Sources.
|
|
87
|
+
Output must be valid JSON that can be parsed without modification.
|
|
88
|
+
Do not include markdown, code fences, comments, or text outside the JSON object.
|
|
89
|
+
Do not include any text, explanations, code blocks (like ```json), or markdown. The response must be the raw JSON string only.
|
|
90
|
+
Always return one and only one valid JSON object.
|
|
91
|
+
The Sources key must contain an array of objects, each with source and snippet keys.
|
|
92
|
+
|
|
93
|
+
The character limit of the value for the "Reasoning" key is strictly 250 characters.
|
|
94
|
+
The character limit of the value for the "Snippet" key is 100.
|
|
95
|
+
The value for the "DueDate" must strictly be 30 days.
|
|
96
|
+
{
|
|
97
|
+
"FieldName": "@@FIELD@@",
|
|
98
|
+
"SuggestedNewValue": "value",
|
|
99
|
+
"OriginalValue": "{!$Input:Opportunity.@@FIELD@@}",
|
|
100
|
+
"Reasoning": "value",
|
|
101
|
+
"DueDate": "30 days",
|
|
102
|
+
"Sources": [
|
|
103
|
+
{
|
|
104
|
+
"source": "value",
|
|
105
|
+
"snippet": "value"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"source": "value",
|
|
109
|
+
"snippet": "value"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"source": "value",
|
|
113
|
+
"snippet": "value"
|
|
114
|
+
}]
|
|
115
|
+
}
|
|
116
|
+
After filling in the values for the JSON, check the following items:
|
|
117
|
+
- The value for the key "SuggestedNewValue" MUST be at most @@CHARCAP@@ characters in length (counting spaces, punctuation, and symbols). Count the characters and if this count is greater than @@CHARCAP@@, you MUST revise the value. Prioritize clarity and conciseness.
|
|
118
|
+
- You must replace any placeholder that exactly matches the pattern "[Provide:{field api label}]" with an empty string. You must not replace any other text that does not follow this exact pattern.</content>
|
|
119
|
+
<inputs>
|
|
120
|
+
<apiName>RelatedEntity</apiName>
|
|
121
|
+
<definition>SOBJECT://Opportunity</definition>
|
|
122
|
+
<referenceName>Input:Opportunity</referenceName>
|
|
123
|
+
<required>true</required>
|
|
124
|
+
</inputs>
|
|
125
|
+
<isCitationEnabled>false</isCitationEnabled>
|
|
126
|
+
<primaryModel>sfdc_ai__DefaultGPT4Omni</primaryModel>
|
|
127
|
+
<status>Published</status>
|
|
128
|
+
<templateDataProviders>
|
|
129
|
+
<definition>flow://sales_pipe_mgmt__GetOppGroundingData</definition>
|
|
130
|
+
<parameters>
|
|
131
|
+
<definition>SOBJECT://Opportunity</definition>
|
|
132
|
+
<isRequired>true</isRequired>
|
|
133
|
+
<parameterName>RelatedEntity</parameterName>
|
|
134
|
+
<valueExpression>{!$Input:Opportunity}</valueExpression>
|
|
135
|
+
</parameters>
|
|
136
|
+
<referenceName>Flow:sales_pipe_mgmt__GetOppGroundingData</referenceName>
|
|
137
|
+
</templateDataProviders>
|
|
138
|
+
</templateVersions>
|
|
139
|
+
<type>einstein_gpt__fieldCompletion</type>
|
|
140
|
+
<visibility>Global</visibility>
|
|
141
|
+
</GenAiPromptTemplate>
|