@salesforce/afv-skills 1.45.0 → 1.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-observe/SKILL.md +32 -4
  3. package/skills/agentforce-observe/references/ahm-alerts.md +719 -0
  4. package/skills/automation-flow-generate/SKILL.md +11 -5
  5. package/skills/consumer-goods-promotion-bo-api-deploy/SKILL.md +275 -0
  6. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/README.md +32 -0
  7. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/SetCommentValue.cls +75 -0
  8. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/SetCommentValue.cls-meta.xml +5 -0
  9. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/interview-answers.json +13 -0
  10. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/copy.json +10 -0
  11. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/create.json +20 -0
  12. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/update.json +16 -0
  13. package/skills/consumer-goods-promotion-bo-api-deploy/references/conventions-and-payload-rules.md +273 -0
  14. package/skills/consumer-goods-promotion-bo-api-deploy/references/generate-and-wire.md +236 -0
  15. package/skills/consumer-goods-promotion-bo-api-deploy/references/reference-example-set-comment-value.md +132 -0
  16. package/skills/consumer-goods-promotion-bo-api-deploy/references/smoke-and-verify.md +211 -0
  17. package/skills/dx-code-analyzer-configure/scripts/validate-config.sh +14 -10
  18. package/skills/dx-code-analyzer-run/scripts/apply-fixes.js +45 -4
  19. package/skills/dx-code-analyzer-run/scripts/describe-rule.js +52 -32
  20. package/skills/dx-devops-project-manage/SKILL.md +197 -0
  21. package/skills/dx-devops-project-manage/examples/common-workflows.md +197 -0
  22. package/skills/dx-devops-project-manage/references/cli-commands.md +295 -0
  23. package/skills/dx-devops-project-manage/scripts/create-project.sh +48 -0
  24. package/skills/dx-devops-project-manage/scripts/list-projects.sh +51 -0
  25. package/skills/dx-devops-project-manage/scripts/update-project.sh +96 -0
  26. package/skills/education-cloud-academic-calendar-generate/SKILL.md +225 -0
  27. package/skills/education-cloud-academic-calendar-generate/examples/quarter-calendar.json +47 -0
  28. package/skills/education-cloud-academic-calendar-generate/examples/sample-output.md +57 -0
  29. package/skills/education-cloud-academic-calendar-generate/examples/semester-calendar.json +54 -0
  30. package/skills/education-cloud-academic-calendar-generate/references/calendar-systems.md +127 -0
  31. package/skills/education-cloud-academic-calendar-generate/references/date-validation.md +222 -0
  32. package/skills/education-cloud-academic-calendar-generate/references/foundation_prerequisites.md +40 -0
  33. package/skills/education-cloud-academic-calendar-generate/scripts/validate_calendar_dates.py +143 -0
  34. package/skills/education-cloud-course-catalog-migrate/SKILL.md +321 -0
  35. package/skills/education-cloud-course-catalog-migrate/references/gotchas-detail.md +16 -0
  36. package/skills/education-cloud-course-catalog-migrate/references/gotchas.md +16 -0
  37. package/skills/education-cloud-course-catalog-migrate/references/large-catalog-handling.md +42 -0
  38. package/skills/education-cloud-course-catalog-migrate/scripts/batch_courses.py +36 -0
  39. package/skills/education-cloud-course-catalog-migrate/scripts/detect_linked_courses.py +51 -0
  40. package/skills/education-cloud-course-catalog-migrate/scripts/detect_modality_variants.py +48 -0
  41. package/skills/education-cloud-course-catalog-migrate/scripts/resolve_api_version.py +43 -0
  42. package/skills/education-cloud-course-catalog-migrate/scripts/split_course_code.py +39 -0
  43. package/skills/education-cloud-course-catalog-migrate/scripts/validate_completeness.py +54 -0
  44. package/skills/education-cloud-multi-campus-configure/references/foundation_prerequisites.md +3 -5
  45. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +177 -0
  46. package/skills/education-cloud-student-recruitment-agent-configure/references/agent-and-subagents.md +151 -0
  47. package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +34 -0
  48. package/skills/education-cloud-student-recruitment-agent-configure/references/execution-model.md +54 -0
  49. package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +82 -0
  50. package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +199 -0
  51. package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +183 -0
  52. package/skills/education-cloud-student-recruitment-agent-configure/references/platform-enablement.md +82 -0
  53. package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +158 -0
  54. package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +141 -0
  55. package/skills/experience-cms-brand-apply/SKILL.md +5 -5
  56. package/skills/experience-cms-brand-create/SKILL.md +2 -2
  57. package/skills/experience-cms-content-generate/SKILL.md +1 -0
  58. package/skills/experience-cms-content-render/SKILL.md +173 -0
  59. package/skills/experience-cms-content-render/assets/angular/DetailPage.component.ts +25 -0
  60. package/skills/experience-cms-content-render/assets/angular/MediaRenderer.component.ts +133 -0
  61. package/skills/experience-cms-content-render/assets/angular/TypeList.component.ts +38 -0
  62. package/skills/experience-cms-content-render/assets/angular/TypeRenderer.component.ts +90 -0
  63. package/skills/experience-cms-content-render/assets/angular/cms-content.component.ts +248 -0
  64. package/skills/experience-cms-content-render/assets/angular/cms-item.service.ts +100 -0
  65. package/skills/experience-cms-content-render/assets/react/DetailPage.tsx +20 -0
  66. package/skills/experience-cms-content-render/assets/react/MediaRenderer.tsx +129 -0
  67. package/skills/experience-cms-content-render/assets/react/TypeList.tsx +40 -0
  68. package/skills/experience-cms-content-render/assets/react/TypeRenderer.tsx +64 -0
  69. package/skills/experience-cms-content-render/assets/react/heuristicRenderer.tsx +310 -0
  70. package/skills/experience-cms-content-render/assets/react/useCmsItem.ts +129 -0
  71. package/skills/experience-cms-content-render/assets/shared/cmsContentType.ts +49 -0
  72. package/skills/experience-cms-content-render/assets/shared/cmsCore.types.ts +96 -0
  73. package/skills/experience-cms-content-render/assets/shared/externalRefs.ts +55 -0
  74. package/skills/experience-cms-content-render/references/bulk-loading.md +60 -0
  75. package/skills/experience-cms-content-render/references/codegen-guardrails.md +111 -0
  76. package/skills/experience-cms-content-render/references/detail-pages.md +87 -0
  77. package/skills/experience-cms-content-render/references/embed-recipes.md +127 -0
  78. package/skills/experience-cms-content-render/references/failure-modes.md +96 -0
  79. package/skills/experience-cms-content-render/references/heuristic-render-rules.md +131 -0
  80. package/skills/experience-cms-content-render/references/init-scaffold.md +122 -0
  81. package/skills/experience-cms-content-render/references/interaction-model.md +173 -0
  82. package/skills/experience-cms-content-render/references/package-api.md +106 -0
  83. package/skills/experience-cms-content-render/references/schema-sync.md +114 -0
  84. package/skills/experience-cms-content-render/references/styling-scopes.md +65 -0
  85. package/skills/experience-cms-content-render/references/verify.md +49 -0
  86. package/skills/experience-cms-content-type-generate/SKILL.md +2 -2
  87. package/skills/experience-content-media-stock-image-search/SKILL.md +5 -4
  88. package/skills/experience-search-coordinate/SKILL.md +198 -0
  89. package/skills/experience-search-coordinate/assets/search-payload-template.json +25 -0
  90. package/skills/experience-search-coordinate/references/content-route.md +313 -0
  91. package/skills/experience-search-coordinate/references/content-type-discovery.md +57 -0
  92. package/skills/experience-search-coordinate/references/media-route.md +172 -0
  93. package/skills/experience-search-coordinate/references/scope-resolution.md +14 -0
  94. package/skills/experience-ui-bundle-localize/SKILL.md +1 -1
  95. package/skills/experience-ui-bundle-localize/references/i18n-setup.md +5 -3
  96. package/skills/experience-ui-bundle-project-generate/SKILL.md +18 -14
  97. package/skills/experience-ui-bundle-project-generate/references/angular-project-generate.md +22 -0
  98. package/skills/experience-ui-bundle-project-generate/references/react-project-generate.md +20 -0
  99. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +58 -54
  100. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +6 -0
  101. package/skills/experience-ui-bundle-salesforce-data-access/references/graphiti-cli.md +2 -2
  102. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +6 -0
  103. package/skills/experience-ui-bundle-salesforce-data-access/references/rest-and-integration.md +2 -1
  104. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +6 -0
  105. package/skills/experience-ui-bundle-site-generate/SKILL.md +59 -8
  106. package/skills/experience-ui-bundle-site-generate/references/configure-metadata-digital-experience.md +8 -3
  107. package/skills/experience-ui-bundle-site-generate/references/configure-metadata-language-settings.md +120 -0
  108. package/skills/life-sciences-fieldsalesrep-coordinate/SKILL.md +336 -0
  109. package/skills/life-sciences-fieldsalesrep-coordinate/references/orchestration-flow.md +143 -0
  110. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-application-flexipage-mapping.md +127 -0
  111. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-deploy-commands.md +116 -0
  112. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-lifesci-metadata-deploy.md +111 -0
  113. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-overview.md +312 -0
  114. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-profile-layout-assignments.md +171 -0
  115. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-state-tracking.md +64 -0
  116. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-trigger-handlers.md +122 -0
  117. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-4-user-provisioning-overview.md +335 -0
  118. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-4-user-provisioning-user-provisioning-details.md +140 -0
  119. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-execution-state-and-recovery.md +196 -0
  120. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-metadata-cache-generation.md +155 -0
  121. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-overview.md +307 -0
  122. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-visit-creation-data.md +211 -0
  123. package/skills/life-sciences-fieldsalesrep-coordinate/references/state-machine-and-changes.md +108 -0
  124. package/skills/life-sciences-kam-coordinate/SKILL.md +241 -0
  125. package/skills/life-sciences-kam-coordinate/references/orchestration-flow.md +152 -0
  126. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-application-flexipage-mapping.md +79 -0
  127. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-deploy-commands.md +131 -0
  128. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-kam-config-records.md +85 -0
  129. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-lifesci-metadata-deploy.md +112 -0
  130. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-overview.md +202 -0
  131. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-profile-layout-assignments.md +67 -0
  132. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-state-tracking.md +65 -0
  133. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-trigger-handlers.md +123 -0
  134. package/skills/life-sciences-kam-coordinate/references/stage-4-participant-role-and-sprint.md +89 -0
  135. package/skills/life-sciences-kam-coordinate/references/stage-5-data-and-plan-templates-overview.md +337 -0
  136. package/skills/life-sciences-kam-coordinate/references/stage-5-data-creation-data.md +248 -0
  137. package/skills/life-sciences-kam-coordinate/references/stage-6-ipad-validation-script.md +35 -0
  138. package/skills/life-sciences-kam-coordinate/references/stage-6-metadata-cache-generation.md +155 -0
  139. package/skills/life-sciences-kam-coordinate/references/stage-6-user-provisioning-details.md +146 -0
  140. package/skills/life-sciences-kam-coordinate/references/stage-6-user-provisioning-overview.md +89 -0
  141. package/skills/life-sciences-kam-coordinate/references/state-machine-and-changes.md +114 -0
  142. package/skills/life-sciences-prerequisites-validate/SKILL.md +138 -0
  143. package/skills/life-sciences-prerequisites-validate/references/checks-org-settings.md +190 -0
  144. package/skills/life-sciences-prerequisites-validate/references/checks-user-and-package.md +211 -0
  145. package/skills/life-sciences-territory-configure/SKILL.md +217 -0
  146. package/skills/life-sciences-territory-configure/references/territory-metadata.md +262 -0
  147. package/skills/platform-apex-logs-debug/SKILL.md +7 -7
  148. package/skills/platform-custom-application-generate/SKILL.md +4 -4
  149. package/skills/platform-custom-object-generate/SKILL.md +7 -7
  150. package/skills/platform-custom-tab-generate/SKILL.md +1 -1
  151. package/skills/platform-dsar-policy-manage/SKILL.md +272 -0
  152. package/skills/platform-dsar-policy-manage/references/configure.md +106 -0
  153. package/skills/platform-dsar-policy-manage/references/export-and-history.md +123 -0
  154. package/skills/platform-dsar-policy-manage/references/gap-analysis-guide.md +150 -0
  155. package/skills/platform-dsar-policy-manage/references/gap-scan.md +129 -0
  156. package/skills/platform-dsar-policy-manage/references/headless-sor.md +59 -0
  157. package/skills/platform-dsar-policy-manage/references/report-format.md +59 -0
  158. package/skills/platform-dsar-policy-manage/scripts/tests/__init__.py +0 -0
  159. package/skills/platform-dsar-policy-manage/scripts/tests/test_validate_policy_tree.py +76 -0
  160. package/skills/platform-dsar-policy-manage/scripts/validate-policy-tree.py +130 -0
  161. package/skills/platform-flexipage-generate/SKILL.md +4 -0
  162. package/skills/platform-list-view-generate/SKILL.md +1 -0
  163. package/skills/platform-salesforce-connect-adapter-generate/SKILL.md +359 -0
  164. package/skills/platform-salesforce-connect-adapter-generate/references/official-examples.md +69 -0
  165. package/skills/platform-salesforce-connect-adapter-generate/references/scenarios.md +187 -0
  166. package/skills/platform-soql-query/SKILL.md +8 -8
  167. package/skills/platform-value-set-generate/SKILL.md +2 -2
  168. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +20 -27
  169. package/skills/service-native-voice-recording-transcription-configure/SKILL.md +47 -27
  170. package/skills/service-native-voice-recording-transcription-configure/references/thunderbird-voice-settings.md +13 -9
  171. package/skills/service-native-voice-recording-transcription-configure/scripts/enable-recording-transcription.sh +104 -45
@@ -0,0 +1,211 @@
1
+ # Prerequisite Checks — User, Package, and Feature Setup
2
+
3
+ Covers the user-access, managed-package, Life Sciences CE feature, and survey checks. For the org-level sharing/data settings (OWD, inventory, account plans, care plans, chatter, data protection, currencies, picklists, person accounts), see `checks-org-settings.md`.
4
+
5
+ Each section contains: the sf CLI command to run, how to interpret the result, and the remediation steps if the check fails.
6
+
7
+ All Tooling API queries use `sf data query --target-org <org> --json --use-tooling-api`. Replace `<org>` with the target org alias.
8
+
9
+ ---
10
+
11
+ ## User Profile and Permission Sets
12
+
13
+ ### Check 1a — System Administrator Profile
14
+
15
+ ```bash
16
+ sf data query --query "SELECT Profile.Name FROM User WHERE Username = '<username>'" --target-org <org> --json
17
+ ```
18
+
19
+ **Pass condition**: `Profile.Name` equals `System Administrator`.
20
+
21
+ **Remediation if failed**:
22
+
23
+ 1. Navigate to **Setup > Users > Users**
24
+ 2. Find the user and click **Edit**
25
+ 3. Change **Profile** to `System Administrator`
26
+ 4. Click **Save**
27
+
28
+ ### Check 1b — LifeSciencesCommercialAdmin Permission Set
29
+
30
+ ```bash
31
+ sf data query --query "SELECT PermissionSet.Name FROM PermissionSetAssignment WHERE AssigneeId IN (SELECT Id FROM User WHERE Username = '<username>') AND PermissionSet.Name = 'LifeSciencesCommercialAdmin'" --target-org <org> --json
32
+ ```
33
+
34
+ **Pass condition**: At least one record returned.
35
+
36
+ **Remediation if failed**:
37
+
38
+ 1. Navigate to **Setup > Users > Permission Sets**
39
+ 2. Find `LifeSciencesCommercialAdmin` and click on it
40
+ 3. Click **Manage Assignments**
41
+ 4. Click **Add Assignment**
42
+ 5. Select the admin user and click **Assign**
43
+
44
+ ### Check 1c — HealthCloudStarter Permission Set
45
+
46
+ ```bash
47
+ sf data query --query "SELECT PermissionSet.Name FROM PermissionSetAssignment WHERE AssigneeId IN (SELECT Id FROM User WHERE Username = '<username>') AND PermissionSet.Name = 'HealthCloudStarter'" --target-org <org> --json
48
+ ```
49
+
50
+ **Pass condition**: At least one record returned.
51
+
52
+ **Remediation if failed**:
53
+
54
+ 1. Navigate to **Setup > Users > Permission Sets**
55
+ 2. Find `HealthCloudStarter` and click on it
56
+ 3. Click **Manage Assignments**
57
+ 4. Click **Add Assignment**
58
+ 5. Select the admin user and click **Assign**
59
+
60
+ ---
61
+
62
+ ## Managed Package Check
63
+
64
+ ### Check — lsc4ce Package Installed
65
+
66
+ Query the `InstalledSubscriberPackage` object via the Tooling API to list installed packages, then check client-side whether one has the namespace prefix `lsc4ce`:
67
+
68
+ ```bash
69
+ sf data query --query "SELECT Id, SubscriberPackage.NamespacePrefix, SubscriberPackage.Name FROM InstalledSubscriberPackage" --target-org <org> --json --use-tooling-api
70
+ ```
71
+
72
+ > **Do NOT add a `WHERE SubscriberPackage.NamespacePrefix = 'lsc4ce'` clause.** On `InstalledSubscriberPackage` the `SubscriberPackage.*` relationship fields are selectable but **not filterable** — a `WHERE` on them fails with `field 'SubscriberPackage' can not be filtered in query call`. Query all installed packages (there are only a handful) and inspect the results for the `lsc4ce` prefix in the agent, not in SOQL.
73
+
74
+ **Pass condition**: At least one returned record has `SubscriberPackage.NamespacePrefix == 'lsc4ce'` (the Life Sciences Cloud for Customer Engagement package is installed).
75
+
76
+ **If failed — STOP all remaining checks** and display:
77
+
78
+ > **BLOCKED: Life Sciences Cloud managed package not installed.**
79
+ >
80
+ > The managed package with namespace prefix `lsc4ce` (Life Sciences Cloud for Customer Engagement) is not installed in this org. All remaining prerequisite checks depend on this package.
81
+ >
82
+ > **Remediation:**
83
+ > 1. Obtain an org with the Life Sciences Cloud for Customer Engagement managed package installed
84
+ > 2. The package is typically provisioned through OrgFarm or installed by Salesforce as part of the Life Sciences Cloud license
85
+ > 3. Contact your Salesforce account team or provisioning admin to get an org with the `lsc4ce` package
86
+ >
87
+ > Re-run this validation after the package is installed.
88
+
89
+ **Do not proceed with any further checks if this fails.**
90
+
91
+ ---
92
+
93
+ ## Life Sciences Customer Engagement Setup
94
+
95
+ All Life Sciences CE settings are stored in `IndustriesSettings` via the Tooling API. Query once and check multiple fields:
96
+
97
+ ```bash
98
+ sf data query --query "SELECT Metadata FROM IndustriesSettings" --target-org <org> --json --use-tooling-api
99
+ ```
100
+
101
+ Parse the `Metadata` object from the first record in the response.
102
+
103
+ ### Check 2a — Life Sciences Customer Engagement Enabled
104
+
105
+ **Field**: `enableLifeSciencesCustomerEngagementBase`
106
+
107
+ **Pass condition**: Value is `true`.
108
+
109
+ **Remediation if failed**:
110
+
111
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
112
+ 2. Toggle **Life Sciences Customer Engagement** to enabled
113
+ 3. Click **Save**
114
+
115
+ ### Check 2b — Enable Settings for Package Installation
116
+
117
+ **Field** (from IndustriesSettings Metadata): `enableLSC4CEPackage`
118
+
119
+ **Pass condition**: Value is `true`.
120
+
121
+ **Remediation if failed**:
122
+
123
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
124
+ 2. Under **Get Your Org Ready to Use Life Sciences Cloud for Customer Engagement**
125
+ 3. Click the **Verify & Enable Settings** button under "Enable Settings for Package Installation"
126
+ 4. Wait for the verification to complete
127
+
128
+ ### Check 2c — Account-Based Sharing
129
+
130
+ **Field** (from IndustriesSettings Metadata): `enableAccountBasedSharing`
131
+
132
+ **Pass condition**: Value is `true`.
133
+
134
+ **Remediation if failed**:
135
+
136
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
137
+ 2. Under **Enable Life Sciences Cloud for Customer Engagement Features**
138
+ 3. Enable **Account-Based Sharing**
139
+ 4. Click **Save**
140
+
141
+ ### Check 2d — Best Contact Time Custom Sharing
142
+
143
+ **Field** (from IndustriesSettings Metadata): `enableCPBestConTimeSharing`
144
+
145
+ **Pass condition**: Value is `true`.
146
+
147
+ **Remediation if failed**:
148
+
149
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
150
+ 2. Under **Enable Life Sciences Cloud for Customer Engagement Features**
151
+ 3. Enable **Best Contact Time Custom Sharing**
152
+ 4. Click **Save**
153
+
154
+ ### Check 2e — Contact Point Social Custom Sharing
155
+
156
+ **Field** (from IndustriesSettings Metadata): `enableCPSocialCustomSharing`
157
+
158
+ **Pass condition**: Value is `true`.
159
+
160
+ **Remediation if failed**:
161
+
162
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
163
+ 2. Under **Enable Life Sciences Cloud for Customer Engagement Features**
164
+ 3. Enable **Contact Point Social Custom Sharing**
165
+ 4. Click **Save**
166
+
167
+ ### Check 2f — Parent Territory Product Alignment
168
+
169
+ **Field** (from IndustriesSettings Metadata): `enablePATSTerritoryBasedSharing`
170
+
171
+ **Pass condition**: Value is `true`.
172
+
173
+ **Remediation if failed**:
174
+
175
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
176
+ 2. Under **Enable Life Sciences Cloud for Customer Engagement Features**
177
+ 3. Enable **Parent Territory Product Alignment**
178
+ 4. Click **Save**
179
+
180
+ ### Check 2g — Product Hierarchy Business Group Filter
181
+
182
+ **Field** (from IndustriesSettings Metadata): `enableProdAdminBusinessGrpFilter`
183
+
184
+ **Pass condition**: Value is `true`.
185
+
186
+ **Remediation if failed**:
187
+
188
+ 1. Navigate to **Setup > Feature Settings > Life Sciences > Life Sciences for Customer Engagement Setup**
189
+ 2. Under **Enable Life Sciences Cloud for Customer Engagement Features**
190
+ 3. Enable **Product Hierarchy Business Group Filter**
191
+ 4. Click **Save**
192
+
193
+ ---
194
+
195
+ ## Surveys
196
+
197
+ ### Check 3 — Surveys Enabled
198
+
199
+ ```bash
200
+ sf data query --query "SELECT Metadata FROM SurveySettings" --target-org <org> --json --use-tooling-api
201
+ ```
202
+
203
+ **Field** (from Metadata): `enableSurvey`
204
+
205
+ **Pass condition**: Value is `true`.
206
+
207
+ **Remediation if failed**:
208
+
209
+ 1. Navigate to **Setup > Feature Settings > Survey > Survey Settings**
210
+ 2. Toggle **Surveys** to enabled
211
+ 3. Click **Save**
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: life-sciences-territory-configure
3
+ description: "Use this skill to create and activate a Territory Type, Territory Model, and Territories for Life Sciences Cloud. Trigger when the user says 'set up territories', 'create territory model', 'configure territory hierarchy for Life Sciences', 'territory setup for LSC', or 'create territories for Life Sciences Cloud'. Creates a Geographical territory type, an LSC Territory Model, and a 3-level territory hierarchy (Region, District, Territory). Confirms names with the user, shows a preview, then deploys and activates the model. DO NOT TRIGGER when: user wants to validate prerequisites, assign users to territories, create territory assignment rules, or run the full end-to-end Life Sciences Cloud setup / orchestration (that is the `life-sciences-fieldsalesrep-coordinate` orchestrator's job — this skill runs only as a standalone territory setup)."
4
+ metadata:
5
+ version: "1.0"
6
+ minApiVersion: "65.0"
7
+ domains: ["Life Sciences"]
8
+ relatedSkills:
9
+ - life-sciences-fieldsalesrep-coordinate
10
+ - life-sciences-prerequisites-validate
11
+ cliTools:
12
+ - tool: ["sf"]
13
+ semver: ">=2.0.0"
14
+ ---
15
+
16
+ # Life Sciences Territory Setup
17
+
18
+ Creates and activates a Territory Type, Territory Model, and a 3-level Territory hierarchy for Life Sciences Cloud using the `sf` CLI.
19
+
20
+ ## Scope
21
+
22
+ - **In scope**: Creating territory type, territory model, and territories; activating the territory model
23
+ - **Out of scope**: Assigning users to territories, creating territory assignment rules, validating prerequisites
24
+
25
+ ### Off-topic requests
26
+
27
+ If the user asks for something unrelated to this skill (either at the start or mid-execution), do not attempt it. Tell the user you did not understand the request, then show what you *can* help with: setting up Life Sciences Cloud territories (this skill), and — if relevant — point them to `life-sciences-prerequisites-validate` for prerequisite checks or `life-sciences-fieldsalesrep-coordinate` for the full end-to-end setup. Then stop and wait.
28
+
29
+ ---
30
+
31
+ ## Required Inputs
32
+
33
+ Gather before proceeding:
34
+
35
+ - **Target org**: The org alias or username to deploy to (from `sf config get target-org` or user-specified)
36
+
37
+ ---
38
+
39
+ ## Workflow
40
+
41
+ ### Phase 1 — Present Default Names and Get Confirmation
42
+
43
+ 1. **Show the user the default names** that will be used for the territory components. Read `references/territory-metadata.md` for the exact XML templates and default names.
44
+
45
+ Present the names in a table:
46
+
47
+ ```markdown
48
+ | Component | Default Name |
49
+ |-----------|-------------|
50
+ | Territory Type | Geographical |
51
+ | Territory Model | LSC Territory Model |
52
+ | Territory (Level 1 - Region) | RD - West 20D |
53
+ | Territory (Level 2 - District) | DM - San Francisco 20D02 |
54
+ | Territory (Level 3 - Territory) | TM - SPC - San Francisco North 20D02T11 |
55
+ ```
56
+
57
+ 2. **Ask the user** if they are fine with these names or want to change any of them. Ask for each component individually:
58
+ - "Are you fine with the Territory Type name **'Geographical'** or would you like to change it?"
59
+ - "Are you fine with the Territory Model name **'LSC Territory Model'** or would you like to change it?"
60
+ - "Are you fine with the Region territory name **'RD - West 20D'** or would you like to change it?"
61
+ - "Are you fine with the District territory name **'DM - San Francisco 20D02'** or would you like to change it?"
62
+ - "Are you fine with the Territory name **'TM - SPC - San Francisco North 20D02T11'** or would you like to change it?"
63
+
64
+ 3. **If the user wants to change a name**, ask them for the new name they'd like to use. Record the updated name.
65
+
66
+ ### Phase 2 — Preview and Confirm
67
+
68
+ 4. **Display a complete preview** of what will be created, showing the final XML for each component with the confirmed names. Use the templates from `references/territory-metadata.md` and substitute any user-provided names.
69
+
70
+ Show the preview in this format:
71
+
72
+ ```text
73
+ === Territory Type ===
74
+ Name: <confirmed name>
75
+ Priority: 1
76
+
77
+ === Territory Model ===
78
+ Name: <confirmed model name>
79
+
80
+ === Territory Hierarchy ===
81
+ Level 1 (Region): <confirmed region name>
82
+ └── Level 2 (District): <confirmed district name>
83
+ └── Level 3 (Territory): <confirmed territory name>
84
+
85
+ Access Levels (all territories):
86
+ - Account: Read
87
+ - Contact: Edit
88
+ - Case: None
89
+ - Opportunity: None
90
+ ```
91
+
92
+ 5. **Ask for final confirmation**: "Ready to create and deploy these territory components? (yes/no)"
93
+
94
+ If user says no, go back to Phase 1.
95
+
96
+ ### Phase 3 — Create and Deploy
97
+
98
+ 6. **Create a temporary SFDX project structure** for deployment. Read `references/territory-metadata.md` for the exact file structure and XML content.
99
+
100
+ The directory structure must be:
101
+
102
+ ```text
103
+ territory-deploy/
104
+ ├── sfdx-project.json
105
+ └── force-app/
106
+ └── main/
107
+ └── default/
108
+ └── territory2Models/
109
+ ├── <ModelApiName>.territory2Model-meta.xml
110
+ └── <ModelApiName>/
111
+ ├── territory2Types/
112
+ │ └── <TypeApiName>.territory2Type-meta.xml
113
+ └── territories/
114
+ ├── <Level1ApiName>.territory2-meta.xml
115
+ ├── <Level2ApiName>.territory2-meta.xml
116
+ └── <Level3ApiName>.territory2-meta.xml
117
+ ```
118
+
119
+ 7. **Generate API names** from user-confirmed display names:
120
+ - Remove special characters, spaces, and hyphens
121
+ - Use PascalCase for the API name
122
+ - Territory type API name is derived from the type display name
123
+ - Territory model API name is derived from the model display name (remove spaces)
124
+ - Territory API names are derived from territory display names (remove spaces, hyphens, special chars)
125
+
126
+ 8. **Write the metadata files** using the templates from `references/territory-metadata.md` with confirmed names.
127
+
128
+ 9. **Deploy the metadata** using:
129
+ ```bash
130
+ sf project deploy start --source-dir territory-deploy/force-app --target-org <org>
131
+ ```
132
+
133
+ 10. **Check deployment status** — if it fails, show the error and suggest remediation.
134
+
135
+ > **STOP-GATE (component count).** The single deploy package must land the **complete** hierarchy: 1 Territory2Type + 1 Territory2Model + 3 Territory2 records (one Region, one District, one Territory). Confirm the deploy result reports **0 component failures** AND verify the territories exist before activating:
136
+ > ```bash
137
+ > sf data query --query "SELECT COUNT(Id) c FROM Territory2 WHERE Territory2Model.DeveloperName = '<ModelApiName>'" --target-org <org> --json
138
+ > ```
139
+ > The count MUST be 3. A parent-reference failure (e.g. the District deploying before its Region) can land a partial hierarchy — a Level-3 territory with no path to its Region silently breaks downstream user/visit territory assignment. Do NOT activate the model (Phase 4) until all 3 territories are present with 0 deploy failures.
140
+
141
+ ### Phase 4 — Activate Territory Model
142
+
143
+ 11. **Report that the model deployed in Planning state** and ask the user if they want to activate it. Include this warning:
144
+
145
+ > **Note:** Once a Territory Model is activated, it can be deactivated but **cannot be deleted**. Do you want to proceed with activation?
146
+
147
+ 12. **If the user confirms activation**, activate the model by querying its record ID then updating its State to `'Activating'` (not `'Active'` — the platform transitions asynchronously from Activating → Active):
148
+
149
+ ```bash
150
+ # Query the model ID and current state
151
+ sf data query --query "SELECT Id, State FROM Territory2Model WHERE DeveloperName = '<ModelApiName>' LIMIT 1" --target-org <org> --json
152
+ ```
153
+
154
+ If the model is in `Planning` state, update it:
155
+
156
+ ```bash
157
+ sf data update record --sobject Territory2Model --record-id <ModelId> --values "State='Activating'" --target-org <org>
158
+ ```
159
+
160
+ See `references/territory-metadata.md` for the full activation logic including error handling.
161
+
162
+ 13. **Verify activation** — the platform transitions asynchronously from `Activating` → `Active`. Query to confirm:
163
+ ```bash
164
+ sf data query --query "SELECT Id, DeveloperName, State FROM Territory2Model WHERE DeveloperName='<ModelApiName>'" --target-org <org>
165
+ ```
166
+ If still `Activating`, wait a moment and query again until it reaches `Active`.
167
+
168
+ 14. **If the user declines activation**, report that the model is in Planning state and can be activated later from Setup.
169
+
170
+ 15. **Report success** — confirm to the user that all components are created, and report the model's current state (`Planning`, `Activating`, or `Active`).
171
+
172
+ ---
173
+
174
+ ## Rules / Constraints
175
+
176
+ | Constraint | Rationale |
177
+ |-----------|-----------|
178
+ | Create exactly one territory per level — one Level-1 Region, one Level-2 District, one Level-3 Territory (3 territories total) | Skill produces a single representative hierarchy branch, not a fully populated multi-child tree |
179
+ | Always confirm names before creating | User may want to customize territory names for their org |
180
+ | Show preview before deploying | User should see exactly what will be created |
181
+ | Deploy all components together | Territory hierarchy has dependencies (parent references) |
182
+ | Warn user before activation that model cannot be deleted once active | Irreversible action — user must explicitly consent |
183
+ | Set State to `'Activating'` (not `'Active'`) when updating the record | The platform handles the async transition from Activating → Active |
184
+ | Target the update by `--record-id <ModelId>` or `--where "DeveloperName='<ModelApiName>'"` | Both forms work for `sf data update record`; use whichever is convenient |
185
+ | Clean up temp directory after deploy | Don't leave deployment artifacts behind |
186
+
187
+ ---
188
+
189
+ ## Gotchas
190
+
191
+ | Issue | Resolution |
192
+ |-------|------------|
193
+ | Territory model already exists with same name | Check first with a query; ask user if they want a different name |
194
+ | Territory type already exists | Check first; reuse existing type if it matches |
195
+ | Deploy fails due to parent territory not found | Ensure all territories are in the same deployment package |
196
+ | Setting State to `'Active'` directly fails with `INVALID_STATUS` | Always set State to `'Activating'` — the platform transitions to Active asynchronously |
197
+ | Model state shows `Activating` after update | This is normal — activation is async. Wait and re-query until `Active` |
198
+ | API name conflicts | Ensure generated API names don't conflict with existing metadata |
199
+
200
+ ---
201
+
202
+ ## Output Expectations
203
+
204
+ Deliverables:
205
+ - Created Territory Type with confirmed name
206
+ - Created Territory Model with confirmed name
207
+ - Created 3-level territory hierarchy with confirmed names
208
+ - Territory Model activated (or manual activation steps if programmatic activation fails)
209
+ - Confirmation message showing all created components and their status
210
+
211
+ ---
212
+
213
+ ## Reference File Index
214
+
215
+ | File | When to read |
216
+ |------|-------------|
217
+ | `references/territory-metadata.md` | During all phases — contains XML templates, file structure, and default values for territory components |
@@ -0,0 +1,262 @@
1
+ # Territory Metadata Templates
2
+
3
+ ## Default Names
4
+
5
+ | Component | Display Name | Default API Name |
6
+ |-----------|-------------|-----------------|
7
+ | Territory Type | Geographical | Geographical |
8
+ | Territory Model | LSC Territory Model | LSCTerritoryModel |
9
+ | Territory (Level 1 - Region) | RD - West 20D | RDWest20D |
10
+ | Territory (Level 2 - District) | DM - San Francisco 20D02 | DMSanFrancisco20D02 |
11
+ | Territory (Level 3 - Territory) | TM - SPC - San Francisco North 20D02T11 | TMSPCSanFranciscoNorth20D02T11 |
12
+
13
+ ---
14
+
15
+ ## File Structure
16
+
17
+ ```text
18
+ territory-deploy/
19
+ ├── sfdx-project.json
20
+ └── force-app/
21
+ └── main/
22
+ └── default/
23
+ └── territory2Models/
24
+ ├── <ModelApiName>.territory2Model-meta.xml
25
+ └── <ModelApiName>/
26
+ ├── territory2Types/
27
+ │ └── <TypeApiName>.territory2Type-meta.xml
28
+ └── territories/
29
+ ├── <Level1ApiName>.territory2-meta.xml
30
+ ├── <Level2ApiName>.territory2-meta.xml
31
+ └── <Level3ApiName>.territory2-meta.xml
32
+ ```
33
+
34
+ ---
35
+
36
+ ## sfdx-project.json
37
+
38
+ ```json
39
+ {
40
+ "packageDirectories": [
41
+ {
42
+ "path": "force-app",
43
+ "default": true
44
+ }
45
+ ],
46
+ "namespace": "",
47
+ "sfdcLoginUrl": "https://login.salesforce.com",
48
+ "sourceApiVersion": "65.0"
49
+ }
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Territory Type XML Template
55
+
56
+ File: `force-app/main/default/territory2Models/<ModelApiName>/territory2Types/<TypeApiName>.territory2Type-meta.xml`
57
+
58
+ ```xml
59
+ <?xml version="1.0" encoding="UTF-8"?>
60
+ <Territory2Type xmlns="http://soap.sforce.com/2006/04/metadata">
61
+ <name>Geographical</name>
62
+ <priority>1</priority>
63
+ </Territory2Type>
64
+ ```
65
+
66
+ ### Fields
67
+
68
+ | Field | Default Value | Description |
69
+ |-------|--------------|-------------|
70
+ | `<name>` | Geographical | Display name of the territory type |
71
+ | `<priority>` | 1 | Priority ranking (1 = highest) |
72
+
73
+ ---
74
+
75
+ ## Territory Model XML Template
76
+
77
+ File: `force-app/main/default/territory2Models/<ModelApiName>.territory2Model-meta.xml`
78
+
79
+ ```xml
80
+ <?xml version="1.0" encoding="UTF-8"?>
81
+ <Territory2Model xmlns="http://soap.sforce.com/2006/04/metadata">
82
+ <name>LSC Territory Model</name>
83
+ </Territory2Model>
84
+ ```
85
+
86
+ ### Fields
87
+
88
+ | Field | Default Value | Description |
89
+ |-------|--------------|-------------|
90
+ | `<name>` | LSC Territory Model | Display name of the territory model |
91
+
92
+ ---
93
+
94
+ ## Territory XML Templates
95
+
96
+ All territories go under: `force-app/main/default/territory2Models/<ModelApiName>/territories/`
97
+
98
+ ### Level 1 — Region (Top-level territory)
99
+
100
+ File: `<Level1ApiName>.territory2-meta.xml`
101
+
102
+ ```xml
103
+ <?xml version="1.0" encoding="UTF-8"?>
104
+ <Territory2 xmlns="http://soap.sforce.com/2006/04/metadata">
105
+ <accountAccessLevel>Read</accountAccessLevel>
106
+ <caseAccessLevel>None</caseAccessLevel>
107
+ <contactAccessLevel>Edit</contactAccessLevel>
108
+ <name>RD - West 20D</name>
109
+ <opportunityAccessLevel>None</opportunityAccessLevel>
110
+ <territory2Type>Geographical</territory2Type>
111
+ </Territory2>
112
+ ```
113
+
114
+ ### Level 2 — District (Child of Region)
115
+
116
+ File: `<Level2ApiName>.territory2-meta.xml`
117
+
118
+ ```xml
119
+ <?xml version="1.0" encoding="UTF-8"?>
120
+ <Territory2 xmlns="http://soap.sforce.com/2006/04/metadata">
121
+ <accountAccessLevel>Read</accountAccessLevel>
122
+ <caseAccessLevel>None</caseAccessLevel>
123
+ <contactAccessLevel>Edit</contactAccessLevel>
124
+ <name>DM - San Francisco 20D02</name>
125
+ <opportunityAccessLevel>None</opportunityAccessLevel>
126
+ <parentTerritory>RDWest20D</parentTerritory>
127
+ <territory2Type>Geographical</territory2Type>
128
+ </Territory2>
129
+ ```
130
+
131
+ ### Level 3 — Territory (Child of District)
132
+
133
+ File: `<Level3ApiName>.territory2-meta.xml`
134
+
135
+ ```xml
136
+ <?xml version="1.0" encoding="UTF-8"?>
137
+ <Territory2 xmlns="http://soap.sforce.com/2006/04/metadata">
138
+ <accountAccessLevel>Read</accountAccessLevel>
139
+ <caseAccessLevel>None</caseAccessLevel>
140
+ <contactAccessLevel>Edit</contactAccessLevel>
141
+ <name>TM - SPC - San Francisco North 20D02T11</name>
142
+ <opportunityAccessLevel>None</opportunityAccessLevel>
143
+ <parentTerritory>DMSanFrancisco20D02</parentTerritory>
144
+ <territory2Type>Geographical</territory2Type>
145
+ </Territory2>
146
+ ```
147
+
148
+ ### Territory Access Levels
149
+
150
+ | Field | Value | Description |
151
+ |-------|-------|-------------|
152
+ | `<accountAccessLevel>` | Read | Read access to accounts in territory |
153
+ | `<caseAccessLevel>` | None | No case access |
154
+ | `<contactAccessLevel>` | Edit | Edit access to contacts in territory |
155
+ | `<opportunityAccessLevel>` | None | No opportunity access |
156
+
157
+ ### Territory Hierarchy Relationships
158
+
159
+ | Territory | Parent | Level |
160
+ |-----------|--------|-------|
161
+ | RDWest20D | (none - top level) | 1 - Region |
162
+ | DMSanFrancisco20D02 | RDWest20D | 2 - District |
163
+ | TMSPCSanFranciscoNorth20D02T11 | DMSanFrancisco20D02 | 3 - Territory |
164
+
165
+ ---
166
+
167
+ ## API Name Generation Rules
168
+
169
+ When the user provides a custom display name, derive the API name as follows:
170
+
171
+ 1. Remove all special characters (hyphens, periods, commas, parentheses)
172
+ 2. Remove all spaces
173
+ 3. Ensure it starts with a letter
174
+ 4. Use only alphanumeric characters
175
+ 5. Keep it concise but recognizable
176
+
177
+ Examples:
178
+ - "RD - West 20D" → `RDWest20D`
179
+ - "DM - San Francisco 20D02" → `DMSanFrancisco20D02`
180
+ - "LSC Territory Model" → `LSCTerritoryModel`
181
+ - "Geographical" → `Geographical`
182
+
183
+ ---
184
+
185
+ ## Deployment Commands
186
+
187
+ ### Deploy all territory metadata
188
+
189
+ ```bash
190
+ sf project deploy start --source-dir territory-deploy/force-app --target-org <org>
191
+ ```
192
+
193
+ ### Activate the territory model
194
+
195
+ The activation uses `sf data update record` to set State to `'Activating'` (NOT `'Active'`). The platform handles the async transition from Activating → Active.
196
+
197
+ > **Warning to present to user before activation:** Once a Territory Model is activated, it can be deactivated but **cannot be deleted**.
198
+
199
+ **Step 1 — Query the model ID and current state:**
200
+
201
+ ```bash
202
+ sf data query \
203
+ --query "SELECT Id, State FROM Territory2Model WHERE DeveloperName = '<ModelApiName>' LIMIT 1" \
204
+ --target-org <org> \
205
+ --json
206
+ ```
207
+
208
+ Parse the result to extract the record `Id` and `State`. If the model is not found, report an error.
209
+
210
+ **Step 2 — If State is `Planning`, update to `Activating`:**
211
+
212
+ By record ID:
213
+
214
+ ```bash
215
+ sf data update record \
216
+ --sobject Territory2Model \
217
+ --record-id <ModelId> \
218
+ --values "State='Activating'" \
219
+ --target-org <org>
220
+ ```
221
+
222
+ Or target by DeveloperName with `--where` (verified equivalent — no record ID lookup needed):
223
+
224
+ ```bash
225
+ sf data update record \
226
+ --sobject Territory2Model \
227
+ --where "DeveloperName='<ModelApiName>'" \
228
+ --values "State=Activating" \
229
+ --target-org <org>
230
+ ```
231
+
232
+ **Important:** Use `State=Activating` — setting to `'Active'` directly will fail with `INVALID_STATUS: A territory model cannot change from the Planning state to the Active state`. The platform advances Activating → Active on its own once the async job completes.
233
+
234
+ **Step 3 — If the update succeeds**, report activation initiated. The model will transition asynchronously to `Active`.
235
+
236
+ **Step 4 — If the model is NOT in `Planning` state** (e.g. already `Active` or `Activating`), report the current state and take no action.
237
+
238
+ ### Verify activation
239
+
240
+ ```bash
241
+ sf data query --query "SELECT Id, DeveloperName, State FROM Territory2Model WHERE DeveloperName='<ModelApiName>'" --target-org <org>
242
+ ```
243
+
244
+ Report the returned `State`. If it is `Activating`, wait and query again until it reaches `Active`.
245
+
246
+ ---
247
+
248
+ ## Pre-deployment Checks
249
+
250
+ Before deploying, verify:
251
+
252
+ 1. No existing territory model with the same DeveloperName:
253
+ ```bash
254
+ sf data query --query "SELECT Id, DeveloperName, State FROM Territory2Model WHERE DeveloperName='<ModelApiName>'" --target-org <org>
255
+ ```
256
+
257
+ 2. No existing territory type with the same DeveloperName:
258
+ ```bash
259
+ sf data query --query "SELECT Id, DeveloperName FROM Territory2Type WHERE DeveloperName='<TypeApiName>'" --target-org <org>
260
+ ```
261
+
262
+ If either exists, inform the user and ask if they want to use a different name or reuse the existing component.