agent-docs 1.0.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/.cursor/plans/OPTIMISE.md +379 -0
- package/.cursor/plans/VERSIONING.md +207 -0
- package/.cursor/rules/IMPORTANT.mdc +97 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +13 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/.github/dependabot.yml +38 -0
- package/.github/pull_request_template.md +10 -0
- package/.github/workflows/format.yml +35 -0
- package/CODE_OF_CONDUCT.md +64 -0
- package/CONTRIBUTING.md +52 -0
- package/LICENSE.md +20 -0
- package/PLAN.md +707 -0
- package/README.md +133 -0
- package/SECURITY.md +21 -0
- package/docs/APEXANNOTATIONS.md +472 -0
- package/docs/APEXDOC.md +198 -0
- package/docs/CML.md +877 -0
- package/docs/CODEANALYZER.md +435 -0
- package/docs/CONTEXTDEFINITIONS.md +617 -0
- package/docs/ESLINT.md +827 -0
- package/docs/ESLINTJSDOC.md +520 -0
- package/docs/FIELDSERVICE.md +4452 -0
- package/docs/GRAPHBINARY.md +208 -0
- package/docs/GRAPHENGINE.md +616 -0
- package/docs/GRAPHML.md +337 -0
- package/docs/GRAPHSON.md +302 -0
- package/docs/GREMLIN.md +490 -0
- package/docs/GRYO.md +232 -0
- package/docs/HUSKY.md +106 -0
- package/docs/JEST.md +387 -0
- package/docs/JORJE.md +537 -0
- package/docs/JSDOC.md +621 -0
- package/docs/PMD.md +910 -0
- package/docs/PNPM.md +409 -0
- package/docs/PRETTIER.md +716 -0
- package/docs/PRETTIERAPEX.md +874 -0
- package/docs/REVENUETRANSACTIONMANAGEMENT.md +887 -0
- package/docs/TINKERPOP.md +252 -0
- package/docs/VITEST.md +706 -0
- package/docs/VSCODE.md +231 -0
- package/docs/XPATH31.md +213 -0
- package/package.json +32 -0
- package/postinstall.mjs +51 -0
- package/prettier.config.js +18 -0
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
# Salesforce Context Definitions Reference
|
|
2
|
+
|
|
3
|
+
> v1.0.0 | Part of Dynamic Revenue Orchestrator (DRO) | Industries Common
|
|
4
|
+
> Resources
|
|
5
|
+
|
|
6
|
+
<!-- NAVIGATION: Basics→DataTypes→Mapping→Filters→Runtime→Limits→Predefined→API→Apex→Flow→Deployment→URLs -->
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Quick Reference
|
|
11
|
+
|
|
12
|
+
### Terminology
|
|
13
|
+
|
|
14
|
+
| Term | Definition |
|
|
15
|
+
| ------------------ | -------------------------------------------------------------------- |
|
|
16
|
+
| Attribute | Property of a node holding data values (Input/Output/InputOutput) |
|
|
17
|
+
| Context | Runtime instance of data structured per context definition |
|
|
18
|
+
| Context Definition | Metadata blueprint defining nodes, attributes, mappings |
|
|
19
|
+
| Context Tag | Auto-generated metadata identifier matching attribute name |
|
|
20
|
+
| Hydration | Process of populating context instance with data from mapped sources |
|
|
21
|
+
| Mapping | Connection between context attributes and Salesforce object fields |
|
|
22
|
+
| Node | Hierarchical element representing a data entity |
|
|
23
|
+
|
|
24
|
+
### Node Types
|
|
25
|
+
|
|
26
|
+
| Type | Description |
|
|
27
|
+
| ----------- | --------------------------------------- |
|
|
28
|
+
| Child | Nested under root or other nodes |
|
|
29
|
+
| Integration | Special node for BRE writeback |
|
|
30
|
+
| Root | Primary entry point node |
|
|
31
|
+
| Sibling | Same hierarchical level as another node |
|
|
32
|
+
|
|
33
|
+
### Attribute Types
|
|
34
|
+
|
|
35
|
+
| Type | Data Flow |
|
|
36
|
+
| ----------- | ----------------------------------------------------- |
|
|
37
|
+
| Input | Into context from mapped source |
|
|
38
|
+
| InputOutput | Bidirectional |
|
|
39
|
+
| Output | Out of context (populated by procedures/calculations) |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Prerequisites & Permissions
|
|
44
|
+
|
|
45
|
+
### Enabling Context Definitions
|
|
46
|
+
|
|
47
|
+
1. Enable Salesforce DRO admin user licenses
|
|
48
|
+
2. Enable Context Service platform license (Context Service Access)
|
|
49
|
+
3. Setup → Context Service → Context Service Settings → Toggle on Context
|
|
50
|
+
Definitions
|
|
51
|
+
|
|
52
|
+
### Required Permissions
|
|
53
|
+
|
|
54
|
+
| Permission | Purpose |
|
|
55
|
+
| ----------------------- | ---------------------------------- |
|
|
56
|
+
| Context Service Access | Basic view/use access |
|
|
57
|
+
| Context Service Admin | Create, modify, delete definitions |
|
|
58
|
+
| Context Service Runtime | Execute context operations |
|
|
59
|
+
| DRO Admin User | Revenue Cloud admin access |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Supported Data Types
|
|
64
|
+
|
|
65
|
+
### Data Type Reference (Alphabetical)
|
|
66
|
+
|
|
67
|
+
| Type | Use Case | Notes |
|
|
68
|
+
| --------- | ------------------ | --------------------------------------- |
|
|
69
|
+
| BOOLEAN | Flags, checkboxes | true/false |
|
|
70
|
+
| CURRENCY | Prices, amounts | Uses org currency settings |
|
|
71
|
+
| DATE | Dates without time | Format: YYYY-MM-DD |
|
|
72
|
+
| DATETIME | Timestamps | Format: YYYY-MM-DDTHH:MM:SSZ (ISO 8601) |
|
|
73
|
+
| EMAIL | Email addresses | Direct mapping |
|
|
74
|
+
| NUMBER | Quantities, counts | Configurable precision/scale |
|
|
75
|
+
| PERCENT | Percentages, rates | Numeric percent value |
|
|
76
|
+
| PHONE | Phone numbers | Direct mapping |
|
|
77
|
+
| PICKLIST | Enumerated values | Multi-select: semicolon-separated |
|
|
78
|
+
| REFERENCE | Record IDs | 18-char Salesforce ID |
|
|
79
|
+
| STRING | Text, names, codes | Up to 255 chars standard |
|
|
80
|
+
| TEXTAREA | Long text | Descriptions, notes |
|
|
81
|
+
| TIME | Time-only values | Format: HH:MM:SS |
|
|
82
|
+
| URL | Web addresses | Direct mapping |
|
|
83
|
+
|
|
84
|
+
### Salesforce Field → Context Attribute Mapping
|
|
85
|
+
|
|
86
|
+
| Salesforce Field Type | Context Data Type |
|
|
87
|
+
| -------------------------- | ---------------------------------------------- |
|
|
88
|
+
| Address | STRING (individual components or concatenated) |
|
|
89
|
+
| Checkbox | BOOLEAN |
|
|
90
|
+
| Currency | CURRENCY |
|
|
91
|
+
| Date | DATE |
|
|
92
|
+
| Date/Time | DATETIME |
|
|
93
|
+
| Email | EMAIL |
|
|
94
|
+
| Formula | Corresponding type based on return type |
|
|
95
|
+
| Geolocation | STRING ("Latitude,Longitude") |
|
|
96
|
+
| Hierarchy Relationship | REFERENCE |
|
|
97
|
+
| Long Text Area | TEXTAREA |
|
|
98
|
+
| Lookup Relationship | REFERENCE |
|
|
99
|
+
| Master-Detail Relationship | REFERENCE |
|
|
100
|
+
| Multi-Select Picklist | PICKLIST (comma-separated) |
|
|
101
|
+
| Number | NUMBER |
|
|
102
|
+
| Percent | PERCENT |
|
|
103
|
+
| Phone | PHONE |
|
|
104
|
+
| Picklist | PICKLIST |
|
|
105
|
+
| Text | STRING |
|
|
106
|
+
| Text Area | TEXTAREA |
|
|
107
|
+
| Time | TIME |
|
|
108
|
+
| URL | URL |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Context Definition Structure
|
|
113
|
+
|
|
114
|
+
### Creation Steps
|
|
115
|
+
|
|
116
|
+
1. Create root node with attributes (Name, Type, Data Type)
|
|
117
|
+
2. Add child/sibling nodes as needed
|
|
118
|
+
3. Create Integration node (if BRE needed) with fixed attributes: `Id`,
|
|
119
|
+
`IntegrationProviderDefId`, `RelatedObject`, `RunAsUserId`, `Status`
|
|
120
|
+
4. Generate All Tags (tag names must match attribute names exactly)
|
|
121
|
+
5. Save and configure mappings
|
|
122
|
+
6. Activate
|
|
123
|
+
|
|
124
|
+
### Context Tags
|
|
125
|
+
|
|
126
|
+
- Auto-generated from attribute names
|
|
127
|
+
- Must match attribute names exactly (case-sensitive)
|
|
128
|
+
- Used for mapping and programmatic access
|
|
129
|
+
- Integration node tag: `IntegrationProviderDcsnRqmt`
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Mapping
|
|
134
|
+
|
|
135
|
+
### Mapping Types
|
|
136
|
+
|
|
137
|
+
| Type | Relationship | Supported Intents |
|
|
138
|
+
| --------------- | --------------------------------- | ------------------------------------- |
|
|
139
|
+
| Cross-Attribute | Attributes across different nodes | Association |
|
|
140
|
+
| Many-to-One | Multiple source → single target | Association, Hydration |
|
|
141
|
+
| One-to-Many | Single source → multiple targets | Association, Persistence, Translation |
|
|
142
|
+
| One-to-One | Direct 1:1 relationship | All intents |
|
|
143
|
+
|
|
144
|
+
### Mapping Intent Types
|
|
145
|
+
|
|
146
|
+
| Intent | Purpose | Supported Mapping Types | Data Flow |
|
|
147
|
+
| ----------- | -------------------------------------------- | ----------------------- | ------------------- |
|
|
148
|
+
| Association | Custom business logic using mapping metadata | All types | N/A (metadata only) |
|
|
149
|
+
| Hydration | Read from Salesforce into context | Many-to-One, One-to-One | SF → Context |
|
|
150
|
+
| Persistence | Write from context to Salesforce | One-to-Many, One-to-One | Context → SF |
|
|
151
|
+
| Translation | Transform between context structures | One-to-Many, One-to-One | Context → Context |
|
|
152
|
+
|
|
153
|
+
### Multiple Intent Compatibility
|
|
154
|
+
|
|
155
|
+
When selecting multiple intents, only common mapping types are available:
|
|
156
|
+
|
|
157
|
+
- Hydration + Translation → One-to-One only
|
|
158
|
+
- Persistence + Translation → One-to-Many, One-to-One
|
|
159
|
+
- Association + Any → All types from Association
|
|
160
|
+
|
|
161
|
+
### Default Mapping
|
|
162
|
+
|
|
163
|
+
- One mapping per definition marked as default
|
|
164
|
+
- Used when no mapping explicitly specified
|
|
165
|
+
- Cannot change default status during deployment (manual post-deploy action)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Context Filters
|
|
170
|
+
|
|
171
|
+
### Filter Configuration
|
|
172
|
+
|
|
173
|
+
| Setting | Limit | Notes |
|
|
174
|
+
| --------------------- | --------------- | --------------------- |
|
|
175
|
+
| Conditions per filter | 5 max | Combine with AND/OR |
|
|
176
|
+
| Logic operators | AND, OR | All or Any conditions |
|
|
177
|
+
| Sort order | Multiple fields | Ascending/Descending |
|
|
178
|
+
|
|
179
|
+
### Supported Operators (Alphabetical)
|
|
180
|
+
|
|
181
|
+
Contains • Equals • Greater Than • Greater Than or Equal • In • Is Empty • Is
|
|
182
|
+
Not Empty • Less Than • Less Than or Equal • Not Contains • Not Equals • Not In
|
|
183
|
+
|
|
184
|
+
### Condition Types
|
|
185
|
+
|
|
186
|
+
| Type | Description | Example |
|
|
187
|
+
| ------- | -------------------------------- | ------------------------------------ |
|
|
188
|
+
| Dynamic | Runtime values/context variables | `AccountId equals {ContextVariable}` |
|
|
189
|
+
| Static | Fixed values | `Status equals 'Active'` |
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Context Service Limits
|
|
194
|
+
|
|
195
|
+
### Structure Limits
|
|
196
|
+
|
|
197
|
+
| Limit | Default | Maximum | Notes |
|
|
198
|
+
| --------------------------------- | ------- | ---------- | ---------------------- |
|
|
199
|
+
| Attributes per context definition | 800 | 1,000 | Total across all nodes |
|
|
200
|
+
| Attributes per node | 200 | 500 | Per individual node |
|
|
201
|
+
| Filter conditions per filter | - | 5 | |
|
|
202
|
+
| Hierarchy depth | - | 5 | Levels |
|
|
203
|
+
| Nodes per context definition | 50 | Contact SF | All node types count |
|
|
204
|
+
|
|
205
|
+
### Runtime Limits
|
|
206
|
+
|
|
207
|
+
| Limit | Default | Maximum | Notes |
|
|
208
|
+
| ---------------------------- | ------- | ------- | --------------------------------------- |
|
|
209
|
+
| Active context instances | - | 20,000 | Within TTL duration |
|
|
210
|
+
| Records per context instance | 10,000 | 20,000 | Total across all nodes |
|
|
211
|
+
| Time To Live (TTL) | 10 min | 45 min | Set at design time, cannot change after |
|
|
212
|
+
|
|
213
|
+
### API Limits
|
|
214
|
+
|
|
215
|
+
- Standard Salesforce API rate limits apply
|
|
216
|
+
- Per-user and per-org limits enforced
|
|
217
|
+
- Request/response size limits apply
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Extending Context Definitions
|
|
222
|
+
|
|
223
|
+
### Extension Rules
|
|
224
|
+
|
|
225
|
+
- Can only extend **standard** definitions (not custom)
|
|
226
|
+
- Cannot modify inherited nodes, attributes, mappings
|
|
227
|
+
- Can add custom nodes, attributes, mappings
|
|
228
|
+
- Auto-syncs when accessed in Setup or hydrated by application
|
|
229
|
+
- **Not** auto-synced when hydration triggered by Apex or Flow
|
|
230
|
+
|
|
231
|
+
### Extension Steps
|
|
232
|
+
|
|
233
|
+
1. Standard Definitions tab → Select definition → Extend
|
|
234
|
+
2. Name your extended definition
|
|
235
|
+
3. Add custom nodes/attributes (optional)
|
|
236
|
+
4. Map Data tab → Edit SObject Mapping → Mark as Default
|
|
237
|
+
5. Map custom attributes to entity fields
|
|
238
|
+
6. Activate
|
|
239
|
+
|
|
240
|
+
### Sync Considerations
|
|
241
|
+
|
|
242
|
+
- Click **Sync Now** after Salesforce upgrades if issues occur
|
|
243
|
+
- Sync fails if: user lacks permissions, limits exceeded, corrupted definitions
|
|
244
|
+
- Perform Sync in sandbox first, then package and deploy to production
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Cloning Context Definitions
|
|
249
|
+
|
|
250
|
+
### Clone vs Extend
|
|
251
|
+
|
|
252
|
+
| Aspect | Clone | Extend |
|
|
253
|
+
| ------------ | ------------------------- | ------------------------------ |
|
|
254
|
+
| Independence | Fully independent copy | Linked to standard definition |
|
|
255
|
+
| Updates | No automatic updates | Auto-syncs with standard |
|
|
256
|
+
| Modification | Full modification allowed | Only add custom components |
|
|
257
|
+
| Use case | Complete customization | Preserve standard + add custom |
|
|
258
|
+
|
|
259
|
+
### Clone Steps
|
|
260
|
+
|
|
261
|
+
1. Context Definitions → Select definition → Clone
|
|
262
|
+
2. Name cloned definition
|
|
263
|
+
3. Modify as needed
|
|
264
|
+
4. Activate before use
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Activation
|
|
269
|
+
|
|
270
|
+
### Activation Status
|
|
271
|
+
|
|
272
|
+
| Status | Description |
|
|
273
|
+
| -------- | -------------------------- |
|
|
274
|
+
| Active | Available for use |
|
|
275
|
+
| Draft | Being created/modified |
|
|
276
|
+
| Inactive | Deactivated, not available |
|
|
277
|
+
|
|
278
|
+
### Activation Rules
|
|
279
|
+
|
|
280
|
+
- Complete structure before activation
|
|
281
|
+
- Configure at least one mapping (mark as default)
|
|
282
|
+
- Cannot activate/deactivate via deployment package (manual only)
|
|
283
|
+
- Activate after deployment to target org
|
|
284
|
+
|
|
285
|
+
### Common Activation Errors
|
|
286
|
+
|
|
287
|
+
| Error | Cause | Resolution |
|
|
288
|
+
| --------------------------------------- | --------------------------------- | ------------------------------- |
|
|
289
|
+
| Context definition already active | Already activated | No action needed |
|
|
290
|
+
| Context definition structure is invalid | Missing required nodes/attributes | Complete structure |
|
|
291
|
+
| No default mapping found | No mapping or no default set | Create and mark default mapping |
|
|
292
|
+
| Permission denied | Insufficient permissions | Grant Context Service Admin |
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Runtime Operations
|
|
297
|
+
|
|
298
|
+
### Flow Invocable Actions
|
|
299
|
+
|
|
300
|
+
| Action | Purpose | Key Parameters |
|
|
301
|
+
| ------------------------- | ----------------------------------- | ------------------------------------------------ |
|
|
302
|
+
| Build Context | Create and hydrate context instance | contextDefinitionId, recordIds, contextMappingId |
|
|
303
|
+
| Delete Context Cache | Remove context from cache | contextId |
|
|
304
|
+
| Persist Context Data | Save context data to Salesforce | contextId, recordIds, contextMappingId |
|
|
305
|
+
| Query Context Tags | Retrieve tag values | contextId, tags |
|
|
306
|
+
| Update Context Attributes | Modify context data | contextId, nodePath, updatedValues |
|
|
307
|
+
|
|
308
|
+
### Runtime Patterns
|
|
309
|
+
|
|
310
|
+
```
|
|
311
|
+
Pattern 1: Simple Hydration
|
|
312
|
+
Build Context → Query Context Tags → Use data → Delete Context Cache
|
|
313
|
+
|
|
314
|
+
Pattern 2: Hydration + Persistence
|
|
315
|
+
Build Context → Query → Update Context Attributes → Persist Context Data → Delete Cache
|
|
316
|
+
|
|
317
|
+
Pattern 3: Translation (Quote→Order)
|
|
318
|
+
Build Context (QuoteMapping) → Query → Build Context (OrderMapping) → Update → Persist → Delete Both
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Persistence Limitations
|
|
322
|
+
|
|
323
|
+
- Cannot persist compound fields (e.g., Contact Name) - must persist individual
|
|
324
|
+
fields (Salutation, FirstName, LastName)
|
|
325
|
+
- If values overridden during Build Context, Persist doesn't store new values
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## REST API Endpoints
|
|
330
|
+
|
|
331
|
+
### Context Definition Management
|
|
332
|
+
|
|
333
|
+
| Endpoint | Methods | Purpose |
|
|
334
|
+
| -------------------------------------------- | ------------------ | --------------------------- |
|
|
335
|
+
| `/connect/context-definitions` | GET, POST | List/create definitions |
|
|
336
|
+
| `/connect/context-definitions/{id}` | DELETE, GET, PATCH | Manage specific definition |
|
|
337
|
+
| `/connect/context-definitions/{id}/filters` | GET, POST | Manage filters |
|
|
338
|
+
| `/connect/context-definitions/{id}/upgrades` | PATCH | Upgrade extended definition |
|
|
339
|
+
|
|
340
|
+
### Context Service Runtime
|
|
341
|
+
|
|
342
|
+
| Endpoint | Methods | Purpose |
|
|
343
|
+
| --------------------------------------- | ----------- | ------------------------------- |
|
|
344
|
+
| `/connect/context-service-runtime` | POST | Create/hydrate context instance |
|
|
345
|
+
| `/connect/context-service-runtime/{id}` | DELETE, GET | Retrieve/delete instance |
|
|
346
|
+
|
|
347
|
+
### API Version
|
|
348
|
+
|
|
349
|
+
Base: `/services/data/vXX.X/connect/...`
|
|
350
|
+
|
|
351
|
+
### HTTP Status Codes
|
|
352
|
+
|
|
353
|
+
| Code | Meaning |
|
|
354
|
+
| ---- | --------------------- |
|
|
355
|
+
| 200 | OK |
|
|
356
|
+
| 201 | Created |
|
|
357
|
+
| 400 | Bad Request |
|
|
358
|
+
| 401 | Unauthorized |
|
|
359
|
+
| 403 | Forbidden |
|
|
360
|
+
| 404 | Not Found |
|
|
361
|
+
| 500 | Internal Server Error |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Apex Development
|
|
366
|
+
|
|
367
|
+
### Namespace & Classes
|
|
368
|
+
|
|
369
|
+
**Namespace:** `Context`
|
|
370
|
+
|
|
371
|
+
| Class | Purpose |
|
|
372
|
+
| ------------------------- | -------------------------- |
|
|
373
|
+
| Context.ContextDefinition | Definition metadata access |
|
|
374
|
+
| Context.ContextException | Error handling |
|
|
375
|
+
| Context.ContextInstance | Instance management |
|
|
376
|
+
| Context.ContextService | Main operations class |
|
|
377
|
+
|
|
378
|
+
### Context.ContextService Methods
|
|
379
|
+
|
|
380
|
+
```apex
|
|
381
|
+
// Build and cache context
|
|
382
|
+
String buildContext(String contextDefinitionId, List<String> recordIds, String contextMappingId)
|
|
383
|
+
|
|
384
|
+
// Delete context from cache
|
|
385
|
+
void deleteContextCache(String contextId)
|
|
386
|
+
|
|
387
|
+
// Persist context data to Salesforce
|
|
388
|
+
void persistContextData(String contextId, List<String> recordIds, String contextMappingId)
|
|
389
|
+
|
|
390
|
+
// Query tag values
|
|
391
|
+
Map<String, Object> queryContextTags(String contextId, List<String> tags)
|
|
392
|
+
|
|
393
|
+
// Update attributes
|
|
394
|
+
void updateContextAttributes(String contextId, String nodePath, Map<String, Object> updatedValues)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Example: Basic Operations
|
|
398
|
+
|
|
399
|
+
```apex
|
|
400
|
+
try {
|
|
401
|
+
// Build context
|
|
402
|
+
String contextId = Context.ContextService.buildContext(
|
|
403
|
+
'SalesTransactionContext',
|
|
404
|
+
new List<String>{'001xx000003DGbQ'},
|
|
405
|
+
null
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
// Query tags
|
|
409
|
+
Map<String, Object> values = Context.ContextService.queryContextTags(
|
|
410
|
+
contextId,
|
|
411
|
+
new List<String>{'AccountNode.Name', 'AccountNode.Id'}
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
// Cleanup
|
|
415
|
+
Context.ContextService.deleteContextCache(contextId);
|
|
416
|
+
|
|
417
|
+
} catch (Context.ContextException e) {
|
|
418
|
+
System.debug('Error: ' + e.getMessage());
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## Deployment
|
|
425
|
+
|
|
426
|
+
### Package Manager Steps
|
|
427
|
+
|
|
428
|
+
1. Setup → Package Manager → New
|
|
429
|
+
2. Add components: Component Type = Context Definition
|
|
430
|
+
3. Upload version (name, number, optional password)
|
|
431
|
+
4. Deploy via installation URL to target org
|
|
432
|
+
5. **Post-install:** Activate definitions, verify mappings
|
|
433
|
+
|
|
434
|
+
### Auto-Included in Package
|
|
435
|
+
|
|
436
|
+
- Context mappings
|
|
437
|
+
- Context filters
|
|
438
|
+
- Custom fields mapped in definitions
|
|
439
|
+
- Custom objects referenced in mappings
|
|
440
|
+
- Dependencies
|
|
441
|
+
|
|
442
|
+
### Deployment Scenarios
|
|
443
|
+
|
|
444
|
+
**✅ Supported:**
|
|
445
|
+
|
|
446
|
+
- Between orgs of same release version
|
|
447
|
+
- Summer '25 → Winter '26 (forward compatible)
|
|
448
|
+
- Add new custom nodes/attributes/mappings
|
|
449
|
+
- Update/delete custom mappings
|
|
450
|
+
|
|
451
|
+
**❌ Unsupported:**
|
|
452
|
+
|
|
453
|
+
- Winter '26 → Summer '25 (backward incompatible)
|
|
454
|
+
- Update/delete custom nodes or attributes during deployment
|
|
455
|
+
- Activate/deactivate in deployment package
|
|
456
|
+
- Change default mapping status in deployment package
|
|
457
|
+
|
|
458
|
+
### Deployment Order
|
|
459
|
+
|
|
460
|
+
1. **Layer 1:** Custom objects/fields → Context definitions → Activate
|
|
461
|
+
2. **Layer 2:** Pricing/Rating procedures → BRE rules → Flows → Apex
|
|
462
|
+
3. **Layer 3:** Lightning components → Page layouts → Permission sets → Apps
|
|
463
|
+
|
|
464
|
+
### Workarounds for Unsupported Scenarios
|
|
465
|
+
|
|
466
|
+
| Scenario | Workaround |
|
|
467
|
+
| ----------------------- | ------------------------------------------ |
|
|
468
|
+
| Modify nodes/attributes | Deactivate in target → modify → reactivate |
|
|
469
|
+
| Delete nodes/attributes | Delete definition in target → redeploy |
|
|
470
|
+
| Activate/deactivate | Manual action in target org post-deploy |
|
|
471
|
+
| Change default mapping | Manual action in target org post-deploy |
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## Predefined Context Definitions (Revenue Cloud)
|
|
476
|
+
|
|
477
|
+
### Transaction Management
|
|
478
|
+
|
|
479
|
+
| Definition | Purpose |
|
|
480
|
+
| --------------------------------- | --------------------------------------------------------- |
|
|
481
|
+
| DynamicRevenueOrchestratorContext | DRO order decomposition/fulfillment |
|
|
482
|
+
| SalesTransactionContext | Sales transactions, Quote/Order management, decomposition |
|
|
483
|
+
|
|
484
|
+
### Product Discovery
|
|
485
|
+
|
|
486
|
+
| Definition | Purpose |
|
|
487
|
+
| ----------------------- | ------------------------------------------------ |
|
|
488
|
+
| ProductDiscoveryContext | Product discovery, qualification rules, browsing |
|
|
489
|
+
|
|
490
|
+
### Rate & Usage Management
|
|
491
|
+
|
|
492
|
+
| Definition | Purpose |
|
|
493
|
+
| ---------------------- | ----------------------------- |
|
|
494
|
+
| RateManagementContext | Usage rating, rate management |
|
|
495
|
+
| RatingDiscoveryContext | Usage rating discovery |
|
|
496
|
+
|
|
497
|
+
### Billing
|
|
498
|
+
|
|
499
|
+
| Definition | Purpose |
|
|
500
|
+
| ------------------------ | ------------------------------------- |
|
|
501
|
+
| BillingContext | Invoice generation, billing schedules |
|
|
502
|
+
| StandaloneBillingContext | Standalone billing schedule creation |
|
|
503
|
+
|
|
504
|
+
### Asset Management
|
|
505
|
+
|
|
506
|
+
| Definition | Purpose |
|
|
507
|
+
| ----------------------- | ------------------------------------------------- |
|
|
508
|
+
| AssetContext\_\_stdctx | Asset-based config rules, Constraint Rules Engine |
|
|
509
|
+
| FulfillmentAssetContext | Fulfillment asset info for decomposition |
|
|
510
|
+
|
|
511
|
+
### Media & Sales
|
|
512
|
+
|
|
513
|
+
| Definition | Purpose |
|
|
514
|
+
| ------------------------------ | ----------------------------------------- |
|
|
515
|
+
| MediaPlanTransactionContext | Ad sales lifecycle, media plan management |
|
|
516
|
+
| SalesAgreementQuotesConversion | Sales agreement ↔ quote conversion |
|
|
517
|
+
|
|
518
|
+
### Other Clouds
|
|
519
|
+
|
|
520
|
+
| Cloud | Example Definitions |
|
|
521
|
+
| ------------------ | ------------------------------ |
|
|
522
|
+
| Field Service | WorkEstimationCoveragesContext |
|
|
523
|
+
| Financial Services | (Cloud-specific) |
|
|
524
|
+
| Health Cloud | (Cloud-specific) |
|
|
525
|
+
| Manufacturing | (Cloud-specific) |
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## Troubleshooting
|
|
530
|
+
|
|
531
|
+
### Common Errors
|
|
532
|
+
|
|
533
|
+
| Error | Cause | Resolution |
|
|
534
|
+
| --------------------------------- | ------------------------------- | --------------------------------- |
|
|
535
|
+
| Context definition is deactivated | Using deactivated definition | Activate before use |
|
|
536
|
+
| Context definition not found | Invalid ID or doesn't exist | Verify ID exists |
|
|
537
|
+
| Context instance not found | Invalid ID or expired/deleted | Verify instance exists |
|
|
538
|
+
| Data type conversion failed | Type mismatch | Check data type compatibility |
|
|
539
|
+
| Field not accessible | Permission/sharing issue | Grant field-level access |
|
|
540
|
+
| Filter condition invalid | Syntax/logic error | Review filter syntax |
|
|
541
|
+
| Governor limit exceeded | Exceeded SF limits | Optimize, batch, reduce data |
|
|
542
|
+
| Invalid context tag | Tag doesn't exist | Verify tag name matches attribute |
|
|
543
|
+
| Invalid data type | Type mismatch | Verify mappings |
|
|
544
|
+
| Invalid mapping type | Incompatible with intent | Check type/intent compatibility |
|
|
545
|
+
| Limit exceeded | Max nodes/attributes reached | Remove unused, contact SF |
|
|
546
|
+
| Mapping not found | Invalid mapping ID | Verify mapping exists |
|
|
547
|
+
| Maximum attributes exceeded | >1000 total | Remove unused attributes |
|
|
548
|
+
| Maximum nodes exceeded | >50 nodes | Remove unused nodes |
|
|
549
|
+
| No default mapping found | No default set | Mark a mapping as default |
|
|
550
|
+
| Permission denied | Insufficient permissions | Grant Context Service Admin |
|
|
551
|
+
| Sync conflict detected | Extended vs standard conflict | Use Override or resolve |
|
|
552
|
+
| Sync failed | Permissions, limits, corruption | Check permissions, contact SF |
|
|
553
|
+
| Timeout error | Operation too long | Reduce data, optimize |
|
|
554
|
+
|
|
555
|
+
### Debug Steps
|
|
556
|
+
|
|
557
|
+
1. Setup → Debug Logs → Create trace flag (FINEST for Context Service)
|
|
558
|
+
2. Reproduce issue
|
|
559
|
+
3. Review: Context operations, SOQL queries, errors, execution times
|
|
560
|
+
4. Check definition status (Active/Inactive)
|
|
561
|
+
5. Validate mappings (types, intents, field paths)
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## URL Reference
|
|
566
|
+
|
|
567
|
+
| ID | URL |
|
|
568
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
569
|
+
| API_BUSINESS | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/context_service_apis.htm |
|
|
570
|
+
| API_CONTEXT_DEF | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_resources_context_definition.htm |
|
|
571
|
+
| API_CONTEXT_DEF_ID | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_resources_context_definition_id.htm |
|
|
572
|
+
| API_CREATE_CONTEXT | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_resources_create_context.htm |
|
|
573
|
+
| API_RUNTIME | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_resources_context_service_runtime.htm |
|
|
574
|
+
| APEX_REF | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/context_service_apex_reference.htm |
|
|
575
|
+
| CLONE | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_clone_context_definitions.htm&type=5 |
|
|
576
|
+
| DEV_GUIDE | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/ |
|
|
577
|
+
| ENABLE | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_turn_on_context_definitions.htm&type=5 |
|
|
578
|
+
| INTERFACE | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_responses_context_definition_interface.htm |
|
|
579
|
+
| INTERFACE_LIST | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/connect_responses_context_definition_interface_metadata_list.htm |
|
|
580
|
+
| META_API | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/context_service_metadata_api_parent.htm |
|
|
581
|
+
| MIGRATE | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_context_definitions_packages.htm&type=5 |
|
|
582
|
+
| PKG_DEPLOY | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_install_use_package.htm&type=5 |
|
|
583
|
+
| PKG_PREPARE | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_prepare_package.htm&type=5 |
|
|
584
|
+
| TOOLING_API | https://developer.salesforce.com/docs/atlas.en-us.industries_reference.meta/industries_reference/context_service_tooling_api_parent.htm |
|
|
585
|
+
| UPGRADE | https://help.salesforce.com/s/articleView?language=en_US&id=ind.context_service_upgrade_context_definitions.htm&type=5 |
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Best Practices Summary
|
|
590
|
+
|
|
591
|
+
### Design
|
|
592
|
+
|
|
593
|
+
- Include only necessary nodes/attributes
|
|
594
|
+
- Minimize hierarchy depth (max 5)
|
|
595
|
+
- Plan for limits during design
|
|
596
|
+
- Use filters to reduce data volume
|
|
597
|
+
|
|
598
|
+
### Performance
|
|
599
|
+
|
|
600
|
+
- Reuse context instances when possible
|
|
601
|
+
- Delete instances when done
|
|
602
|
+
- Use appropriate TTL (shorter = fresher data, longer = fewer hydrations)
|
|
603
|
+
- Batch operations to avoid governor limits
|
|
604
|
+
|
|
605
|
+
### Deployment
|
|
606
|
+
|
|
607
|
+
- Test in sandbox first
|
|
608
|
+
- Deploy context definitions before dependent components
|
|
609
|
+
- Activate manually after deployment
|
|
610
|
+
- Document changes and versions
|
|
611
|
+
|
|
612
|
+
### Maintenance
|
|
613
|
+
|
|
614
|
+
- Remove unused nodes/attributes/filters
|
|
615
|
+
- Monitor usage against limits
|
|
616
|
+
- Sync extended definitions after upgrades
|
|
617
|
+
- Archive old definitions
|