@salesforce/afv-skills 1.59.0 → 1.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-architecture-analyze/SKILL.md +66 -17
  3. package/skills/agentforce-architecture-analyze/assets/cli/show_access_token.yaml +4 -7
  4. package/skills/agentforce-architecture-analyze/references/contract.json +1 -1
  5. package/skills/agentforce-architecture-analyze/scripts/emit_env.py +2 -2
  6. package/skills/agentforce-architecture-analyze/scripts/main.py +40 -44
  7. package/skills/agentforce-architecture-analyze/scripts/rest_client.py +11 -3
  8. package/skills/agentforce-architecture-analyze/scripts/sf_cli.py +77 -10
  9. package/skills/agentforce-architecture-analyze/scripts/tests/test_end_to_end_fixture.py +1 -0
  10. package/skills/agentforce-architecture-analyze/scripts/tests/test_flow_children_inflation.py +1 -0
  11. package/skills/agentforce-architecture-analyze/scripts/tests/test_main_pipeline.py +53 -2
  12. package/skills/agentforce-architecture-analyze/scripts/tests/test_resolve_creds.py +184 -36
  13. package/skills/agentforce-architecture-analyze/scripts/tests/test_rest_client.py +17 -0
  14. package/skills/agentforce-architecture-analyze/scripts/tests/test_sf_cli.py +165 -11
  15. package/skills/agentforce-architecture-analyze/scripts/tests/test_skill_md_pipeline_block.py +319 -0
  16. package/skills/agentforce-d360-analyze/SKILL.md +28 -10
  17. package/skills/agentforce-d360-analyze/scripts/dc.py +200 -50
  18. package/skills/agentforce-d360-analyze/scripts/discover_sessions.py +10 -6
  19. package/skills/agentforce-d360-analyze/scripts/fetch_dc.py +22 -6
  20. package/skills/agentforce-d360-analyze/scripts/resolve_session.py +21 -13
  21. package/skills/agentforce-d360-analyze/scripts/tests/test_dc_and_resolve_session.py +298 -76
  22. package/skills/agentforce-d360-analyze/scripts/tests/test_default_target_org.py +432 -0
  23. package/skills/agentforce-d360-analyze/scripts/tests/test_discover_sessions.py +1 -1
  24. package/skills/agentforce-d360-analyze/scripts/tests/test_resolve_session_main.py +9 -3
  25. package/skills/agentforce-d360-analyze/scripts/tests/test_skill_md_prefix_block.py +176 -0
  26. package/skills/consumer-goods-accruals-datakit-deploy/SKILL.md +17 -27
  27. package/skills/consumer-goods-accruals-datakit-deploy/scripts/setup.js +7 -17
  28. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/00-check-prerequisites.js +47 -63
  29. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/01-download-static-resource.js +10 -13
  30. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/02-replace-org-id.js +46 -46
  31. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/03-deploy-metadata.js +4 -21
  32. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/06-create-dataspace.js +58 -82
  33. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/07-deploy-accruals-reports.js +16 -315
  34. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/08-deploy-ui.js +9 -24
  35. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/09-completion.js +44 -44
  36. package/skills/consumer-goods-accruals-datakit-deploy/scripts/steps/utils.js +11 -63
  37. package/skills/consumer-goods-rtr-datacloud-export-configure/SKILL.md +2 -1
  38. package/skills/consumer-goods-tpe-dashboard-configure/SKILL.md +2 -1
  39. package/skills/consumer-goods-tpe-dashboard-custom-kpi-configure/SKILL.md +2 -1
  40. package/skills/consumer-goods-tpe-datakit-deploy/SKILL.md +2 -1
  41. package/skills/data360-schema-get/SKILL.md +3 -3
  42. package/skills/design-systems-slds-validate/references/report-format.md +1 -1
  43. package/skills/dx-org-manage/SKILL.md +1 -0
  44. package/skills/dx-org-shape-manage/SKILL.md +1 -0
  45. package/skills/dx-org-snapshot-manage/SKILL.md +172 -0
  46. package/skills/dx-org-snapshot-manage/examples/create_error_output.json +16 -0
  47. package/skills/dx-org-snapshot-manage/examples/create_success_output.json +19 -0
  48. package/skills/dx-org-snapshot-manage/examples/delete_output.json +9 -0
  49. package/skills/dx-org-snapshot-manage/examples/get_output.json +19 -0
  50. package/skills/dx-org-snapshot-manage/examples/list_output.json +36 -0
  51. package/skills/dx-org-snapshot-manage/references/cli_flags.md +179 -0
  52. package/skills/dx-org-snapshot-manage/references/snapshot_usage.md +55 -0
  53. package/skills/dx-org-trial-expiration-check/SKILL.md +1 -1
  54. package/skills/dx-org-trial-expiration-check/scripts/check_expiration.sh +2 -2
  55. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +7 -5
  56. package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +11 -11
  57. package/skills/experience-content-media-image-generate/SKILL.md +83 -0
  58. package/skills/experience-content-media-image-generate/scripts/download-image.sh +84 -0
  59. package/skills/external-diagram-mermaid-generate/SKILL.md +12 -12
  60. package/skills/field-service-data-capture-migrate/references/component-mapping.md +1 -1
  61. package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +1 -2
  62. package/skills/field-service-data-capture-migrate/references/known-deploy-errors.md +1 -0
  63. package/skills/field-service-data-capture-migrate/references/transformer-rules.md +1 -1
  64. package/skills/field-service-data-capture-migrate/scripts/transform_flow.py +12 -1
  65. package/skills/field-service-data-capture-migrate/scripts/vendor/build_flow.py +4 -1
  66. package/skills/field-service-setup-orchestrator-get/SKILL.md +0 -1
  67. package/skills/insurance-brokerage-agency-billing-configure/SKILL.md +233 -0
  68. package/skills/insurance-brokerage-agency-billing-configure/references/accounting-setup.md +117 -0
  69. package/skills/insurance-brokerage-agency-billing-configure/references/billing-rules-config.md +237 -0
  70. package/skills/insurance-brokerage-agency-billing-configure/references/billing-settings.md +271 -0
  71. package/skills/insurance-brokerage-agency-billing-configure/references/demo-policy-config.md +138 -0
  72. package/skills/insurance-brokerage-agency-billing-configure/references/org-defaults.md +64 -0
  73. package/skills/insurance-brokerage-agency-billing-configure/references/permissions-config.md +226 -0
  74. package/skills/insurance-brokerage-agency-billing-configure/references/prerequisites.md +142 -0
  75. package/skills/life-sciences-fieldsalesrep-coordinate/SKILL.md +3 -2
  76. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-execution-state-and-recovery.md +3 -3
  77. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-overview.md +68 -45
  78. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-visit-creation-data.md +17 -18
  79. package/skills/life-sciences-kam-coordinate/references/stage-5-data-and-plan-templates-overview.md +16 -3
  80. package/skills/life-sciences-kam-coordinate/references/stage-5-data-creation-data.md +16 -13
  81. package/skills/marketing-message-test/SKILL.md +194 -0
  82. package/skills/marketing-message-test/references/api-contract.md +333 -0
  83. package/skills/omnistudio-callable-apex-generate/SKILL.md +3 -3
  84. package/skills/omnistudio-datamapper-generate/SKILL.md +6 -6
  85. package/skills/omnistudio-datapacks-deploy/SKILL.md +11 -11
  86. package/skills/omnistudio-dependencies-analyze/SKILL.md +5 -5
  87. package/skills/omnistudio-epc-catalog-generate/SKILL.md +6 -6
  88. package/skills/omnistudio-flexcard-generate/SKILL.md +6 -6
  89. package/skills/omnistudio-integration-procedure-generate/SKILL.md +6 -6
  90. package/skills/omnistudio-omniscript-generate/SKILL.md +6 -5
  91. package/skills/platform-apex-logs-debug/SKILL.md +1 -0
  92. package/skills/platform-metadata-deploy/SKILL.md +1 -0
  93. package/skills/platform-models-api-configure/SKILL.md +5 -5
  94. package/skills/platform-soql-query/SKILL.md +1 -0
  95. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +17 -6
  96. package/skills/service-itsm-agentic-setup-incident-sla-configure/SKILL.md +107 -192
  97. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/attach-milestone-action.json +6 -6
  98. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/milestone-patterns.md +49 -20
  99. package/skills/service-itsm-agentic-setup-incident-sla-configure/examples/output-templates.md +4 -4
  100. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/mcp-invocation.md +224 -290
  101. package/skills/service-itsm-agentic-setup-incident-sla-configure/references/workflow.md +295 -0
  102. package/skills/service-itsm-incident-priority-configure/SKILL.md +1 -1
  103. package/skills/service-itsm-slack-itservice-configure/SKILL.md +2 -1
  104. package/skills/service-itsm-slack-itservice-configure/references/manage-slack-connection.md +2 -2
  105. package/skills/service-omni-channel-setup-coordinate/SKILL.md +20 -13
  106. package/skills/service-omni-channel-setup-coordinate/scripts/integration-driver.sh +5 -55
  107. package/skills/service-omni-channel-setup-coordinate/scripts/tests/test_omni_contracts.py +0 -38
  108. package/skills/service-omni-command-center-analyze/SKILL.md +2 -3
  109. package/skills/service-omni-command-center-analyze/scripts/analyze.sh +3 -3
  110. package/skills/tableau-next-asset-create/README.md +65 -0
  111. package/skills/tableau-next-asset-create/SKILL.md +409 -0
  112. package/skills/tableau-next-asset-create/references/admin-users.md +149 -0
  113. package/skills/tableau-next-asset-create/references/ai-readiness.md +355 -0
  114. package/skills/tableau-next-asset-create/references/alerts.md +111 -0
  115. package/skills/tableau-next-asset-create/references/build-workflow.md +819 -0
  116. package/skills/tableau-next-asset-create/references/dashboard-authoring.md +302 -0
  117. package/skills/tableau-next-asset-create/references/dashboard-design-principles.md +352 -0
  118. package/skills/tableau-next-asset-create/references/data-transform-gotchas.md +210 -0
  119. package/skills/tableau-next-asset-create/references/data-understanding.md +387 -0
  120. package/skills/tableau-next-asset-create/references/deep-reference-index.md +74 -0
  121. package/skills/tableau-next-asset-create/references/destructive-operations.md +62 -0
  122. package/skills/tableau-next-asset-create/references/edit-dashboard.md +273 -0
  123. package/skills/tableau-next-asset-create/references/edit-visualization.md +529 -0
  124. package/skills/tableau-next-asset-create/references/empty-source-handling.md +104 -0
  125. package/skills/tableau-next-asset-create/references/ingest-and-metric-gotchas.md +638 -0
  126. package/skills/tableau-next-asset-create/references/insight-bundle.md +69 -0
  127. package/skills/tableau-next-asset-create/references/large-flat-file-handling.md +331 -0
  128. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/_envelope.json +54 -0
  129. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/_shared-widget-fields.json +122 -0
  130. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/add_page.json +29 -0
  131. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/delete_page.json +27 -0
  132. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/discard_dashboard.json +11 -0
  133. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/move_widget.json +30 -0
  134. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/move_widget_to_page.json +30 -0
  135. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/place_widget_on_page.json +30 -0
  136. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/remove_widget_from_dashboard.json +16 -0
  137. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/remove_widget_from_page.json +26 -0
  138. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/rename_page.json +28 -0
  139. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/save_dashboard.json +18 -0
  140. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/undo.json +11 -0
  141. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_button_widget.json +69 -0
  142. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_container_widget.json +88 -0
  143. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_filter_widget.json +146 -0
  144. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_metric_widget.json +78 -0
  145. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_navigation_widget.json +80 -0
  146. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_parameter_widget.json +160 -0
  147. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_text_widget.json +103 -0
  148. package/skills/tableau-next-asset-create/references/schemas/edit-dashboard/upsert_visualization_widget.json +68 -0
  149. package/skills/tableau-next-asset-create/references/sdm-tool-reference.md +721 -0
  150. package/skills/tableau-next-asset-create/references/semantic-query-and-enrichment.md +355 -0
  151. package/skills/tableau-next-asset-create/references/shared-gates.md +322 -0
  152. package/skills/tableau-next-asset-create/references/sharing-and-promotion.md +306 -0
  153. package/skills/tableau-next-asset-create/references/tasks/ai-readiness-audit.md +51 -0
  154. package/skills/tableau-next-asset-create/references/tasks/analyze-data.md +48 -0
  155. package/skills/tableau-next-asset-create/references/tasks/build-dashboard.md +66 -0
  156. package/skills/tableau-next-asset-create/references/tasks/build-end-to-end.md +73 -0
  157. package/skills/tableau-next-asset-create/references/tasks/create-data-transform.md +51 -0
  158. package/skills/tableau-next-asset-create/references/tasks/create-viz.md +58 -0
  159. package/skills/tableau-next-asset-create/references/tasks/edit-dashboard.md +80 -0
  160. package/skills/tableau-next-asset-create/references/tasks/edit-sdm.md +106 -0
  161. package/skills/tableau-next-asset-create/references/tasks/edit-viz.md +40 -0
  162. package/skills/tableau-next-asset-create/references/tasks/enrich-model.md +68 -0
  163. package/skills/tableau-next-asset-create/references/tasks/ingest-flat-file.md +68 -0
  164. package/skills/tableau-next-asset-create/references/tasks/manage-alert.md +35 -0
  165. package/skills/tableau-next-asset-create/references/tasks/profile-dataset.md +47 -0
  166. package/skills/tableau-next-asset-create/references/tasks/promote-or-reuse.md +46 -0
  167. package/skills/tableau-next-asset-create/references/tasks/provision-user.md +39 -0
  168. package/skills/tableau-next-asset-create/references/tasks/query-model.md +92 -0
  169. package/skills/tableau-next-asset-create/references/tasks/review-verified-questions.md +42 -0
  170. package/skills/tableau-next-asset-create/references/tasks/share-asset.md +37 -0
  171. package/skills/tableau-next-asset-create/references/verified-questions.md +125 -0
  172. package/skills/tableau-next-asset-create/references/viz-authoring.md +992 -0
  173. package/skills/service-itsm-agentic-setup-incident-sla-configure/assets/predefined-incident-policy.json +0 -102
@@ -0,0 +1,237 @@
1
+ # Phase 3: Billing Rules Configuration
2
+
3
+ For every record: query broadly first using `dispatch GET /query?q=<SOQL>`, then create only what is missing. Proceed autonomously without asking.
4
+
5
+ All creates: `dispatch POST /sobjects/<Object>` with a JSON body.
6
+ All updates: `dispatch PATCH /sobjects/<Object>/<recordId>` with a JSON body.
7
+
8
+ ---
9
+
10
+ ## 1. Legal Entity
11
+
12
+ **Object:** `LegalEntity`
13
+
14
+ **Search:**
15
+ ```text
16
+ dispatch GET /query?q=SELECT+Id,Name,CompanyName,Description,Status+FROM+LegalEntity+WHERE+Status='Active'
17
+ ```
18
+
19
+ If any active entities exist, use the first one found. Do not add CurrencyIsoCode to this query — LegalEntity has no such field on orgfarm orgs, and including it fails the query with 400 INVALID_FIELD.
20
+
21
+ **Create (if none found):**
22
+ ```text
23
+ dispatch POST /sobjects/LegalEntity
24
+ {"Name": "US Legal Entity", "CompanyName": "Agency Sync Brokerages", "Description": "Primary US legal entity for Agency Billing", "Status": "Active"}
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 2. Billing Treatments (3 types)
30
+
31
+ **Object:** `BillingTreatment` + child `BillingTreatmentItem`
32
+
33
+ **Search all:**
34
+ ```text
35
+ dispatch GET /query?q=SELECT+Id,Name,Status,ExcludeFromBilling,IsMilestoneBilling,(SELECT+Id,Name,Status,ProcessingOrder,Type,Percentage,BillingType,MilestoneType,MilestoneStartDate,MilestoneStartDateOffset,MilestoneStartDateOffsetUnit+FROM+BillingTreatmentItems)+FROM+BillingTreatment+WHERE+Status='Active'
36
+ ```
37
+
38
+ **Match criteria:**
39
+ - Advance: `IsMilestoneBilling=false`, Name contains "Advance", child BTI with `BillingType='Advance'`
40
+ - Arrears: `IsMilestoneBilling=false`, Name contains "Arrear", child BTI with `BillingType='Arrears'`
41
+ - Milestone 60-20-20: `IsMilestoneBilling=true`, 3 child BTIs with percentages 60/20/20
42
+
43
+ **Creation sequence (MUST follow this order):**
44
+ 1. Create BillingTreatment in `Status='Draft'`
45
+ 2. Create all BillingTreatmentItems in `Status='Active'`
46
+ 3. Update BillingTreatment to `Status='Active'`
47
+
48
+ ### Advance
49
+
50
+ Parent:
51
+ ```text
52
+ dispatch POST /sobjects/BillingTreatment
53
+ {"Name": "Advance Billing Treatment", "ExcludeFromBilling": "No", "IsMilestoneBilling": false, "Status": "Draft"}
54
+ ```
55
+
56
+ Item (Percentage is required even for Advance/Arrears types; CurrencyIsoCode is NOT a field on this object):
57
+ ```text
58
+ dispatch POST /sobjects/BillingTreatmentItem
59
+ {"Name": "Advance Billing Treatment Item", "Status": "Active", "Type": "Percentage", "Percentage": 100, "BillingType": "Advance", "BillingTreatmentId": "<BT_ID>"}
60
+ ```
61
+
62
+ Activate:
63
+ ```text
64
+ dispatch PATCH /sobjects/BillingTreatment/<BT_ID>
65
+ {"Status": "Active"}
66
+ ```
67
+
68
+ ### Arrears
69
+
70
+ Parent:
71
+ ```text
72
+ dispatch POST /sobjects/BillingTreatment
73
+ {"Name": "Arrear Billing Treatment", "ExcludeFromBilling": "No", "IsMilestoneBilling": false, "Status": "Draft"}
74
+ ```
75
+
76
+ Item:
77
+ ```text
78
+ dispatch POST /sobjects/BillingTreatmentItem
79
+ {"Name": "Arrear Billing Treatment Item", "Status": "Active", "Type": "Percentage", "Percentage": 100, "BillingType": "Arrears", "BillingTreatmentId": "<BT_ID>"}
80
+ ```
81
+
82
+ Activate:
83
+ ```text
84
+ dispatch PATCH /sobjects/BillingTreatment/<BT_ID>
85
+ {"Status": "Active"}
86
+ ```
87
+
88
+ ### Milestone 60-20-20
89
+
90
+ Parent:
91
+ ```text
92
+ dispatch POST /sobjects/BillingTreatment
93
+ {"Name": "Hybrid 60-20-20", "ExcludeFromBilling": "No", "IsMilestoneBilling": true, "Status": "Draft"}
94
+ ```
95
+
96
+ Items (3) — no CurrencyIsoCode on this object:
97
+ ```text
98
+ dispatch POST /sobjects/BillingTreatmentItem
99
+ {"Name": "60% Milestone", "Status": "Active", "ProcessingOrder": 1, "Type": "Percentage", "Percentage": 60, "BillingType": "None", "MilestoneType": "Date", "MilestoneStartDate": "OrderProductActivation", "MilestoneStartDateOffset": 10, "MilestoneStartDateOffsetUnit": "Days", "BillingTreatmentId": "<BT_ID>"}
100
+ ```
101
+
102
+ ```text
103
+ dispatch POST /sobjects/BillingTreatmentItem
104
+ {"Name": "20% Milestone - Second", "Status": "Active", "ProcessingOrder": 2, "Type": "Percentage", "Percentage": 20, "BillingType": "None", "MilestoneType": "Date", "MilestoneStartDate": "OrderProductActivation", "MilestoneStartDateOffset": 2, "MilestoneStartDateOffsetUnit": "Months", "BillingTreatmentId": "<BT_ID>"}
105
+ ```
106
+
107
+ ```text
108
+ dispatch POST /sobjects/BillingTreatmentItem
109
+ {"Name": "20% Milestone - Third", "Status": "Active", "ProcessingOrder": 3, "Type": "Percentage", "Percentage": 20, "BillingType": "None", "MilestoneType": "Date", "MilestoneStartDate": "OrderProductActivation", "MilestoneStartDateOffset": 3, "MilestoneStartDateOffsetUnit": "Months", "BillingTreatmentId": "<BT_ID>"}
110
+ ```
111
+
112
+ Activate:
113
+ ```text
114
+ dispatch PATCH /sobjects/BillingTreatment/<BT_ID>
115
+ {"Status": "Active"}
116
+ ```
117
+
118
+ ---
119
+
120
+ ## 3. Tax Engine
121
+
122
+ **Object:** `TaxEngine` (name field is `TaxEngineName`, NOT `Name`)
123
+
124
+ **Search:**
125
+ ```text
126
+ dispatch GET /query?q=SELECT+Id,TaxEngineName,Type,Status+FROM+TaxEngine+WHERE+Type='InsuranceTaxProration'+AND+Status='Active'
127
+ ```
128
+
129
+ **Create:**
130
+ ```text
131
+ dispatch POST /sobjects/TaxEngine
132
+ {"TaxEngineName": "Insurance Tax Proration Engine", "Type": "InsuranceTaxProration", "Status": "Active"}
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 4. Tax Treatment
138
+
139
+ **Object:** `TaxTreatment`
140
+
141
+ **Search:**
142
+ ```text
143
+ dispatch GET /query?q=SELECT+Id,Name,Status,IsTaxable,TaxEngineId+FROM+TaxTreatment+WHERE+IsTaxable=true+AND+Status='Active'
144
+ ```
145
+
146
+ **Create:**
147
+ ```text
148
+ dispatch POST /sobjects/TaxTreatment
149
+ {"Name": "Passthrough Tax", "Status": "Active", "IsTaxable": true, "TaxEngineId": "<TAX_ENGINE_ID>"}
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 5. Payment Term + Item
155
+
156
+ **Object:** `PaymentTerm` + child `PaymentTermItem`
157
+
158
+ **Search:**
159
+ ```text
160
+ dispatch GET /query?q=SELECT+Id,Name,IsDefault,Status,(SELECT+Id,Name,Type,PaymentTimeframe,Period,PeriodUnit+FROM+PaymentTermItems)+FROM+PaymentTerm+WHERE+Status='Active'
161
+ ```
162
+
163
+ **Create parent (Status and IsDefault must be set AFTER child item exists):**
164
+ ```text
165
+ dispatch POST /sobjects/PaymentTerm
166
+ {"Name": "Net 10"}
167
+ ```
168
+
169
+ **Create item** (Type is `Period-Based`, PeriodUnit is singular):
170
+ ```text
171
+ dispatch POST /sobjects/PaymentTermItem
172
+ {"Type": "Period-Based", "PaymentTimeframe": "Standard", "Period": 10, "PeriodUnit": "Days", "PaymentTermId": "<PT_ID>"}
173
+ ```
174
+
175
+ **Activate parent after item exists:**
176
+ ```text
177
+ dispatch PATCH /sobjects/PaymentTerm/<PT_ID>
178
+ {"Status": "Active", "IsDefault": true}
179
+ ```
180
+
181
+ > Platform enforces: cannot save PaymentTerm with Status=Active until a child PaymentTermItem exists. Create parent without Status, add child, then PATCH to Active+IsDefault.
182
+
183
+ > **Org prerequisite:** PaymentTerm is only writable when billing features are enabled (Phase 1 Step 3). On orgs without billing, the sObject describe returns `createable: false` — this is expected and does not indicate a gap in the skill.
184
+
185
+ ---
186
+
187
+ ## 6. Product Selling Models (5 records)
188
+
189
+ **Object:** `ProductSellingModel`
190
+
191
+ **Search all:**
192
+ ```text
193
+ dispatch GET /query?q=SELECT+Id,Name,SellingModelType,PricingTerm,PricingTermUnit,Status+FROM+ProductSellingModel+ORDER+BY+Name
194
+ ```
195
+
196
+ **Match by SellingModelType + PricingTermUnit (fuzzy on Name):**
197
+
198
+ | SellingModelType | PricingTermUnit | Default Name |
199
+ |-----------------|-----------------|--------------|
200
+ | OneTime | Months | One time |
201
+ | TermDefined | Months | Term Defined - Monthly |
202
+ | TermDefined | Quarterly | Term Defined - Quarterly |
203
+ | TermDefined | Semi-Annual | Term Defined - Semi Annual |
204
+ | TermDefined | Annual | Term Defined - Annual |
205
+
206
+ **Create pattern (TermDefined types):**
207
+ ```text
208
+ dispatch POST /sobjects/ProductSellingModel
209
+ {"Name": "<NAME>", "SellingModelType": "<TYPE>", "PricingTerm": 1, "PricingTermUnit": "<UNIT>", "Status": "Active"}
210
+ ```
211
+
212
+ **Create pattern (OneTime — no PricingTerm or PricingTermUnit):**
213
+ ```text
214
+ dispatch POST /sobjects/ProductSellingModel
215
+ {"Name": "One time", "SellingModelType": "OneTime", "Status": "Active"}
216
+ ```
217
+
218
+ > Platform enforces: OneTime selling models cannot have PricingTerm or PricingTermUnit set. Omit both fields.
219
+
220
+ ---
221
+
222
+ ## 7. Proration Policy
223
+
224
+ **Object:** `ProrationPolicy` (has NO Status field)
225
+
226
+ **Search:**
227
+ ```text
228
+ dispatch GET /query?q=SELECT+Id,Name,RemainderStrategy,ArePartialPeriodsAllowed,ProrationPolicyType+FROM+ProrationPolicy
229
+ ```
230
+
231
+ **Match:** `RemainderStrategy='AddToLast'` AND `ArePartialPeriodsAllowed=false`
232
+
233
+ **Create:**
234
+ ```text
235
+ dispatch POST /sobjects/ProrationPolicy
236
+ {"Name": "No Partial Proration Add to Last", "RemainderStrategy": "AddToLast", "ArePartialPeriodsAllowed": false, "ProrationPolicyType": "StandardTimePeriods"}
237
+ ```
@@ -0,0 +1,271 @@
1
+ # Phase 2: Billing Settings
2
+
3
+ ## Read Current State
4
+
5
+ ```text
6
+ dispatch GET /headless/invoke/platform/billing-settings/get-billing-general-setting-states
7
+ ```
8
+
9
+ Returns a map of all current billing setting states. Compare each key against the desired values below and write only settings that differ.
10
+
11
+ ---
12
+
13
+ ## Billing Settings
14
+
15
+ ### Transaction Journal Creation
16
+
17
+ **Key in read response:** `TxnJournalCreationEnabled`
18
+ **Desired:** `true`
19
+
20
+ ```text
21
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-txn-journal-creation-enabled
22
+ {"TxnJournalCreationEnabled": true}
23
+ ```
24
+
25
+ ---
26
+
27
+ ### Payment Schedules and Items Creation
28
+
29
+ **Key in read response:** `PaymentScheduleAutomationEnabled`
30
+ **Desired:** `true`
31
+
32
+ ```text
33
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-payment-schedule-automation-enabled
34
+ {"paymentScheduleAutomation": true}
35
+ ```
36
+
37
+ ---
38
+
39
+ ### Convert Negative Invoice Lines to Credit Memo Lines
40
+
41
+ **Key in read response:** `ApplyConvertedNegIL`
42
+ **Desired:** `true`
43
+
44
+ ```text
45
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-apply-converted-neg-il
46
+ {"applyConvertedNegIL": true}
47
+ ```
48
+
49
+ ---
50
+
51
+ ### Credit Memo Application to Posted Invoices
52
+
53
+ **Key in read response:** `PaymentApplicationToInvEnabled`
54
+ **Desired:** `true`
55
+
56
+ ```text
57
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-payment-application-to-inv-enabled
58
+ {"PaymentApplicationToInvEnabled": true}
59
+ ```
60
+
61
+ ---
62
+
63
+ ### Invoice PDF Generation + Invoice Email Delivery (Tooling API)
64
+
65
+ These two fields live on the `BillingSettings` Metadata type. No headless route exists — use the Tooling API read/mutate/write-back pattern (same approach as `InsuranceBrokerageSettings`).
66
+
67
+ **Read current state (captures the full blob — required for the PATCH):**
68
+ ```text
69
+ dispatch GET /tooling/query?q=SELECT+Id,Metadata+FROM+BillingSettings
70
+ ```
71
+
72
+ Returns one record with `Id` and a `Metadata` object containing all billing settings fields.
73
+
74
+ **Write (must send the full Metadata blob — partial writes wipe omitted fields):**
75
+
76
+ Take the `Metadata` object from the read response, set the two invoice fields to `true`, then PATCH the entire blob back:
77
+
78
+ ```text
79
+ dispatch PATCH /tooling/sobjects/BillingSettings/<id>
80
+ {
81
+ "Metadata": {
82
+ "<all other fields from read, unchanged>": "...",
83
+ "enableInvoicePdfGeneration": true,
84
+ "enableInvoiceEmailDelivery": true
85
+ }
86
+ }
87
+ ```
88
+
89
+ **Verify:** re-read `SELECT Metadata FROM BillingSettings` and confirm both fields are `true`.
90
+
91
+ ---
92
+
93
+ ### Billing Context Definition
94
+
95
+ **Desired:** `BillingContext__stdctx`
96
+
97
+ ```text
98
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-billing-ctx-def-org-value-and-get-mapping
99
+ {"selectedContextDefinition": "BillingContext__stdctx"}
100
+ ```
101
+
102
+ ---
103
+
104
+ ### Billing Context Source Mapping
105
+
106
+ **Desired:** `OrderEntitiesMapping`
107
+
108
+ **First, get available mapping options** (returned by the context definition setter):
109
+ ```text
110
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-billing-ctx-def-org-value-and-get-mapping
111
+ {"selectedContextDefinition": "BillingContext__stdctx"}
112
+ ```
113
+
114
+ This returns the available mappings. Then set the source mapping:
115
+
116
+ ```text
117
+ dispatch PATCH /headless/invoke/platform/billing-tax-configurations/set-billing-cxt-def-mapping-org-value
118
+ {"selectedMapping": "OrderEntitiesMapping"}
119
+ ```
120
+
121
+ ---
122
+
123
+ ### Intra Context Custom Mapping
124
+
125
+ **Desired:** `BSGEntitiesMapping`
126
+
127
+ ```text
128
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-billing-intra-cxt-def-mapping-org-value
129
+ {"selectedIntraContextCustomMapping": "BSGEntitiesMapping"}
130
+ ```
131
+
132
+ ---
133
+
134
+ ### Rule-Based Credit and Payment Application Order
135
+
136
+ **Desired:** `{"first":"Payments","rules":["EM","EA","OI","HI"]}`
137
+ - `first: Payments` — apply payments before credit memos
138
+ - `EM` = Exact Match, `EA` = Exact Account, `OI` = Oldest Invoice, `HI` = Highest Invoice
139
+
140
+ ```text
141
+ dispatch PATCH /headless/invoke/platform/billing-settings/set-rules-based-application-order-org-value
142
+ {"rulesBasedApplicationOrder": "{\"first\":\"Payments\",\"rules\":[\"EM\",\"EA\",\"OI\",\"HI\"]}"}
143
+ ```
144
+
145
+ ---
146
+
147
+ ## InsuranceBrokerage Settings
148
+
149
+ > **Must run after Billing is enabled (Phase 1 Step 3).** The `InsuranceSettingsPageController` returns `NOT_IMPLEMENTED` until billing setup is on.
150
+
151
+ ### Generate Insurance Policy Transaction Details (iptdEnabledForBrokerage)
152
+
153
+ **Read current state:**
154
+ ```text
155
+ dispatch GET /setup/org/values/I_P_T_D_ENABLED_FOR_BROKERAGE
156
+ ```
157
+ Returns `{ booleanValue: boolean }`.
158
+
159
+ **Enable (must run BEFORE InsuranceBilling):**
160
+ ```text
161
+ dispatch PATCH /setup/org/values/I_P_T_D_ENABLED_FOR_BROKERAGE
162
+ {"orgValue": true}
163
+ ```
164
+
165
+ **Verify:** re-read, confirm `booleanValue = true`.
166
+
167
+ > NOT via `handle-pref-enable` — that route's write guard checks `InsuranceBrokerageSettings` Metadata type which may not be present. Use `setup/org/values` instead (the same path the UI calls via `SetupApiFamilyController.updateOrgValue`).
168
+
169
+ ---
170
+
171
+ ### Generate Insurance Policy Transactions (iptEnabledForBrokerage)
172
+
173
+ **Read current state:**
174
+ ```text
175
+ dispatch GET /setup/org/values/I_P_T_ENABLED_FOR_BROKERAGE
176
+ ```
177
+ Returns `{ booleanValue: boolean }`.
178
+
179
+ **Enable (requires I_P_T_D_ENABLED_FOR_BROKERAGE to be on first):**
180
+ ```text
181
+ dispatch PATCH /setup/org/values/I_P_T_ENABLED_FOR_BROKERAGE
182
+ {"orgValue": true}
183
+ ```
184
+
185
+ **Verify:** re-read, confirm `booleanValue = true`.
186
+
187
+ ---
188
+
189
+ ### Context Mapping Fields
190
+
191
+ These three context mapping fields use the same `/setup/org/values/*` pattern as IPTD and IPT above (backed by `SetupApiFamilyController.updateOrgValue`).
192
+
193
+ #### insBrkBillingCtxDef
194
+
195
+ **Read current state:**
196
+ ```text
197
+ dispatch GET /setup/org/values/INS_BRK_BILLING_CTX_DEF
198
+ ```
199
+ Returns `{ booleanValue, dateValue, numberValue, stringValue }`.
200
+
201
+ **Set (if not already correct):**
202
+ ```text
203
+ dispatch PATCH /setup/org/values/INS_BRK_BILLING_CTX_DEF
204
+ {"orgValue": "InsBillingTransactionContext__stdctx"}
205
+ ```
206
+
207
+ **Verify:** re-read, confirm `stringValue = "InsBillingTransactionContext__stdctx"`.
208
+
209
+ ---
210
+
211
+ #### insBrkBillingCtxSchedGrpMap
212
+
213
+ **Read current state:**
214
+ ```text
215
+ dispatch GET /setup/org/values/INS_BRK_BILLING_CTX_SCHED_GRP_MAP
216
+ ```
217
+
218
+ **Set (if not already correct):**
219
+ ```text
220
+ dispatch PATCH /setup/org/values/INS_BRK_BILLING_CTX_SCHED_GRP_MAP
221
+ {"orgValue": "BSGEntitiesMapping"}
222
+ ```
223
+
224
+ **Verify:** re-read, confirm `stringValue = "BSGEntitiesMapping"`.
225
+
226
+ ---
227
+
228
+ #### insBrkBillingCtxTnxMapping
229
+
230
+ **Read current state:**
231
+ ```text
232
+ dispatch GET /setup/org/values/INS_BRK_BILLING_CTX_TNX_MAPPING
233
+ ```
234
+
235
+ **Set (if not already correct):**
236
+ ```text
237
+ dispatch PATCH /setup/org/values/INS_BRK_BILLING_CTX_TNX_MAPPING
238
+ {"orgValue": "InsBillingTransactionMapping"}
239
+ ```
240
+
241
+ **Verify:** re-read, confirm `stringValue = "InsBillingTransactionMapping"`.
242
+
243
+ > **Note:** The Tooling API path (`SELECT Metadata FROM InsuranceBrokerageSettings`) returns `INVALID_TYPE` on standard orgfarm orgs. These `/setup/org/values/*` routes are the correct headless path and work universally.
244
+
245
+ ---
246
+
247
+ ## Design Document Templates
248
+
249
+ **Must run after billing is enabled (Phase 1, Step 3).** The `BillingGettingStartedController` is only available once billing setup is on.
250
+
251
+ **Read current state:**
252
+ ```text
253
+ dispatch GET /headless/invoke/platform/document-generation-setting/get-init-data
254
+ ```
255
+ Returns `{ canUserAccessDocGenSettingsUI, nameSpacePrefix }`.
256
+
257
+ **Check if already enabled:**
258
+ ```text
259
+ dispatch GET /headless/invoke/platform/document-generation-setting/fetch-doc-gen-setting-records
260
+ ```
261
+ Returns count of existing DocGen setting records. If `0`, the feature is not yet enabled.
262
+
263
+ **Enable via billing setup route** (after billing is on):
264
+ ```text
265
+ dispatch PATCH /headless/invoke/platform/accounting-guided-setup/setup-billing-doc-gen-and-fetch-invoice-template-data
266
+ {"BillingDocGenEnabled": true}
267
+ ```
268
+
269
+ > This route was validated in the route corpus. On the probe org it returned `NOT_IMPLEMENTED` because billing was not yet enabled — this is expected. Run this step after Phase 1 Step 3 (billing enablement) completes.
270
+
271
+ **Verify:** re-call `GET /headless/invoke/platform/document-generation-setting/fetch-doc-gen-setting-records` and confirm count > 0.
@@ -0,0 +1,138 @@
1
+ # Phase 7: Demo Policy Configuration
2
+
3
+ All creates use `dispatch POST /sobjects/<Object>` with a JSON body.
4
+ All queries use `dispatch GET /query?q=<SOQL>`.
5
+
6
+ ---
7
+
8
+ ## Duplicate Check
9
+
10
+ Before creating any records, query for an existing Account with the same name:
11
+
12
+ ```text
13
+ dispatch GET /query?q=SELECT+Id,Name+FROM+Account+WHERE+Name='Pinnacle+Ridge+Insurance+Group'
14
+ ```
15
+
16
+ If found, reuse the existing Account instead of creating a duplicate.
17
+
18
+ ---
19
+
20
+ ## Record Creation Chain
21
+
22
+ Create in this exact order (each depends on the previous):
23
+
24
+ 1. Account
25
+ 2. Contact (linked to Account)
26
+ 3. Insurance Policy (linked to Account via NameInsuredId)
27
+ 4. Coverages (linked to Policy)
28
+ 5. Surcharges (linked to Policy AND Coverage)
29
+ 6. Insurance Policy Billing Information (linked to Policy, Contact, and all Phase 3 records)
30
+
31
+ ---
32
+
33
+ ## Default Demo Data
34
+
35
+ ### Account
36
+
37
+ ```text
38
+ dispatch POST /sobjects/Account
39
+ {"Name": "Pinnacle Ridge Insurance Group", "BillingStreet": "100 Main Street", "BillingCity": "San Francisco", "BillingState": "CA", "BillingPostalCode": "94105", "BillingCountry": "US", "ShippingStreet": "100 Main Street", "ShippingCity": "San Francisco", "ShippingState": "CA", "ShippingPostalCode": "94105", "ShippingCountry": "US"}
40
+ ```
41
+
42
+ ---
43
+
44
+ ### Contact
45
+
46
+ ```text
47
+ dispatch POST /sobjects/Contact
48
+ {"FirstName": "Sarah", "LastName": "Mitchell", "Title": "VP of Risk Management", "Email": "sarah.mitchell@pinnacleridge.example.com", "Phone": "415-555-0142", "AccountId": "<ACCOUNT_ID>"}
49
+ ```
50
+
51
+ ---
52
+
53
+ ### Insurance Policy
54
+
55
+ Compute dates at runtime:
56
+ - `EffectiveFromDate`: January 1 of current year
57
+ - `EffectiveToDate`: December 31 of current year
58
+
59
+ ```text
60
+ dispatch POST /sobjects/InsurancePolicy
61
+ {"Name": "PRI-CGL-2026-001", "PolicyName": "Commercial General Liability", "PolicyType": "General Liability", "Status": "In Force", "EffectiveFromDate": "<CURRENT_YEAR>-01-01", "EffectiveToDate": "<CURRENT_YEAR>-12-31", "NameInsuredId": "<ACCOUNT_ID>"}
62
+ ```
63
+
64
+ ---
65
+
66
+ ### Coverages (2)
67
+
68
+ Coverage 1 — Bodily Injury (no CurrencyIsoCode on InsurancePolicyCoverage):
69
+ ```text
70
+ dispatch POST /sobjects/InsurancePolicyCoverage
71
+ {"CoverageName": "Bodily Injury Liability", "StandardPremiumAmount": 45000, "InsurancePolicyId": "<POLICY_ID>"}
72
+ ```
73
+
74
+ Coverage 2 — Property Damage:
75
+ ```text
76
+ dispatch POST /sobjects/InsurancePolicyCoverage
77
+ {"CoverageName": "Property Damage Liability", "StandardPremiumAmount": 30000, "InsurancePolicyId": "<POLICY_ID>"}
78
+ ```
79
+
80
+ ---
81
+
82
+ ### Surcharges (3 — on coverages, NOT directly on policy)
83
+
84
+ On Bodily Injury:
85
+ ```text
86
+ dispatch POST /sobjects/InsurancePolicySurcharge
87
+ {"Name": "State Premium Tax - BI", "SurchargeAmount": 2250, "Type": "Tax", "ApplicableObjectType": "InsurancePolicyCoverage", "InsurancePolicyId": "<POLICY_ID>", "InsurancePolicyCoverageId": "<BI_COVERAGE_ID>"}
88
+ ```
89
+
90
+ ```text
91
+ dispatch POST /sobjects/InsurancePolicySurcharge
92
+ {"Name": "Municipal Assessment - BI", "SurchargeAmount": 450, "Type": "Tax", "ApplicableObjectType": "InsurancePolicyCoverage", "InsurancePolicyId": "<POLICY_ID>", "InsurancePolicyCoverageId": "<BI_COVERAGE_ID>"}
93
+ ```
94
+
95
+ On Property Damage:
96
+ ```text
97
+ dispatch POST /sobjects/InsurancePolicySurcharge
98
+ {"Name": "State Premium Tax - PD", "SurchargeAmount": 1500, "Type": "Tax", "ApplicableObjectType": "InsurancePolicyCoverage", "InsurancePolicyId": "<POLICY_ID>", "InsurancePolicyCoverageId": "<PD_COVERAGE_ID>"}
99
+ ```
100
+
101
+ ---
102
+
103
+ ### Insurance Policy Billing Information
104
+
105
+ > **Phase 2 must complete before this step.** The billing lookup fields (`BillingTreatmentId`, `TaxTreatmentId`, `ProrationPolicyId`, `PaymentTermId`, `ProductSellingModelId`, `LegalEntityId`) are hidden from describe and SOQL until the billing permission sets are assigned. If the POST returns INVALID_FIELD on any of these, go back and complete Phase 2 first.
106
+
107
+ Resolve all lookups from Phase 3 record IDs:
108
+ ```text
109
+ dispatch POST /sobjects/InsPolicyBillingInfo
110
+ {"BillDayOfMonth": 15, "InsurancePolicyId": "<POLICY_ID>", "BillToContactId": "<CONTACT_ID>", "BillingTreatmentId": "<ADVANCE_BT_ID>", "TaxTreatmentId": "<TAX_TREATMENT_ID>", "ProrationPolicyId": "<PRORATION_POLICY_ID>", "PaymentTermId": "<PAYMENT_TERM_ID>", "ProductSellingModelId": "<MONTHLY_PSM_ID>", "LegalEntityId": "<LEGAL_ENTITY_ID>"}
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Verification
116
+
117
+ After all records are created:
118
+
119
+ ```text
120
+ dispatch GET /query?q=SELECT+Id,Name,PolicyName,PolicyType,Status,EffectiveFromDate,EffectiveToDate,(SELECT+Id,CoverageName,StandardPremiumAmount+FROM+InsurancePolicyCoverages),(SELECT+Id,Name,SurchargeAmount,Type+FROM+InsurancePolicySurcharges)+FROM+InsurancePolicy+WHERE+Id='<POLICY_ID>'
121
+ ```
122
+
123
+ ```text
124
+ dispatch GET /query?q=SELECT+Id,BillDayOfMonth,BillingTreatmentId,TaxTreatmentId,ProrationPolicyId,PaymentTermId,ProductSellingModelId,LegalEntityId+FROM+InsPolicyBillingInfo+WHERE+InsurancePolicyId='<POLICY_ID>'
125
+ ```
126
+
127
+ ## Expected Totals
128
+
129
+ - Total premium: $75,000 (45,000 + 30,000)
130
+ - Total tax/surcharges: $4,200 (2,250 + 450 + 1,500)
131
+ - Grand total: $79,200
132
+
133
+ ## Next Steps (manual, tell the user)
134
+
135
+ 1. Navigate to the policy and click "Issue"
136
+ 2. After issuance, go to Insurance Policy Transaction and click "Send to Billing"
137
+ 3. Generate invoices from Account page or Billing Schedule Group
138
+ 4. Process payments and review journal entries