You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data.md
+35-4Lines changed: 35 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -283,7 +283,7 @@ Event:
283
283
action: select
284
284
select_options:
285
285
strategy: similarity
286
-
filter: WHERE Subject IN ('Sample Event')
286
+
filter: WHERE Subject LIKE 'Meeting%'
287
287
priority_fields:
288
288
- Subject
289
289
- WhoId
@@ -305,11 +305,13 @@ Event:
305
305
306
306
#### Selection Strategies
307
307
308
+
The `strategy` parameter determines how records are selected from the target org. It is **optional**; if no strategy is specified, the `standard` strategy will be applied by default.
309
+
308
310
- **`standard` Strategy:**
309
-
The `standard` selection strategy retrieves records from Salesforce in the same order as they appear, applying any specified filters and sorting criteria. This method ensures that records are selected without any prioritization based on similarity or randomness, offering a straightforward way to pull the desired data.
311
+
The `standard` selection strategy retrieves records from target org in the same order as they appear, applying any specified filters and sorting criteria. This method ensures that records are selected without any prioritization based on similarity or randomness, offering a straightforward way to pull the desired data.
310
312
311
313
- **`similarity` Strategy:**
312
-
The `similarity` strategy is used when you need to find records in Salesforce that closely resemble the records defined in your SQL file. This strategy performs a similarity match between the records in the SQL file and those in Salesforce. In addition to comparing the fields of the record itself, this strategy includes the fields of parent records (up to one level) for a more granular and accurate match.
314
+
The `similarity` strategy is used when you need to find records in the target org that closely resemble the records defined in your SQL file. This strategy performs a similarity match between the records in the SQL file and those in the target org. In addition to comparing the fields of the record itself, this strategy includes the fields of parent records (up to one level) for a more granular and accurate match.
313
315
314
316
- **`random` Strategy:**
315
317
The `random` selection strategy randomly assigns records picked from the target org. This method is useful when the selection order does not matter, and you simply need to fetch records in a randomized manner.
@@ -320,17 +322,21 @@ Event:
320
322
321
323
The selection `filter` provides a flexible way to refine the records selected by using any functionality supported by SOQL. This includes filtering, sorting, and limiting records based on specific conditions, such as using the `WHERE` clause to filter records by field values, the `ORDER BY` clause to sort records in ascending or descending order, and the `LIMIT` clause to restrict the number of records returned. Essentially, any feature available in SOQL for record selection is supported here, allowing you to tailor the selection process to your precise needs and ensuring only the relevant records are included in the mapping process.
322
324
325
+
This parameter is **optional**; and if not specified, no filter will apply.
326
+
323
327
---
324
328
325
329
#### Priority Fields
326
330
327
331
The `priority_fields` feature enables you to specify a subset of fields in your mapping step that will have more weight during the similarity matching process. When similarity matching is performed, these priority fields will be given greater importance compared to other fields, allowing for a more refined match.
328
332
333
+
This parameter is **optional**; and if not specified, all fields will be considered with same priority.
334
+
329
335
This feature is particularly useful when certain fields are more critical in defining the identity or relevance of a record, ensuring that these fields have a stronger influence in the selection process.
330
336
331
337
---
332
338
333
-
#### Select + Insert
339
+
#### Threshold
334
340
335
341
This feature allows you to either select or insert records based on a similarity threshold. When using the `select` action with the `similarity` strategy, you can specify a `threshold` value between `0` and `1`, where `0` represents a perfect match and `1` signifies no similarity.
336
342
@@ -340,10 +346,35 @@ This feature allows you to either select or insert records based on a similarity
340
346
- **Insert Records:**
341
347
If the similarity score exceeds the threshold, the record will be inserted into the target org instead of being selected.
342
348
349
+
This parameter is **optional**; if not specified, no threshold will be applied and all records will default to be selected.
350
+
343
351
This feature is particularly useful during version upgrades, where records that closely match can be selected, while those that do not match sufficiently can be inserted into the target org.
344
352
345
353
---
346
354
355
+
#### Example
356
+
357
+
To demonstrate the `select` functionality, consider the example of the `Event` entity, which utilizes the `similarity` strategy, a filter condition, and other advanced options to select matching records effectively as given in the yaml above.
358
+
359
+
1. **Basic Object Configuration**:
360
+
361
+
- The `Account`, `Contact`, and `Lead` objects are configured for straightforward field mapping.
362
+
- A `lookup` is defined on the `Contact` object to map `AccountId` to the `Account` table.
363
+
364
+
2. **Advanced `Event` Object Mapping**:
365
+
- **Action**: The `Event` object uses the `select` action, meaning records are selected rather than inserted.
366
+
- **Strategy**: The `similarity` strategy matches `Event` records in target org that are similar to those defined in the SQL file.
367
+
- **Filter**: Only `Event` records with a `Subject` field starting with "Meeting" are considered.
368
+
- **Priority Fields**: The `Subject` and `WhoId` fields are given more weight during similarity matching.
369
+
- **Threshold**: A similarity score of 0.3 is used to determine whether records are selected or inserted.
370
+
- **Lookups**:
371
+
- The `WhoId` field looks up records from either the `Contact` or `Lead` objects.
372
+
- The `WhatId` field looks up records from the `Account` object.
373
+
374
+
This example highlights how the `select` functionality can be applied in real-world scenarios, such as selecting `Event` records that meet specific criteria while considering similarity, filters, and priority fields.
375
+
376
+
---
377
+
347
378
### Database Mapping
348
379
349
380
CumulusCI's definition format includes considerable flexibility for use
0 commit comments