Skip to content

Commit 8c2bb3a

Browse files
Add documentation for 'select' functionality
1 parent ebd5f08 commit 8c2bb3a

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

docs/data.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,43 @@ Insert Accounts:
250250
Whenever `update_key` is supplied, the action must be `upsert` and vice
251251
versa.
252252

253+
### Selects
254+
255+
The "select" functionality enhances the mapping process by enabling direct record selection from the target Salesforce org for lookups. This is achieved by specifying the `select` action in the mapping file, particularly useful when dealing with objects dependent on non-insertable Salesforce objects.
256+
257+
```yaml
258+
Select Accounts:
259+
sf_object: Account
260+
action: select
261+
selection_strategy: standard
262+
selection_filter: WHERE Name IN ('Bluth Company', 'Camacho PLC')
263+
fields:
264+
- Name
265+
- AccountNumber
266+
Insert Contacts:
267+
sf_object: Contact
268+
action: insert
269+
fields:
270+
- LastName
271+
lookups:
272+
AccountId:
273+
table: Account
274+
```
275+
276+
The `Select Accounts` section in this YAML demonstrates how to fetch specific records from your Salesforce org. These selected Account records will then be referenced by the subsequent `Insert Contacts` section via lookups, ensuring that new Contacts are linked to the pre-existing Accounts chosen in the `select` step rather than relying on any newly inserted Account records.
277+
278+
#### Selection Strategy
279+
280+
The `selection_strategy` dictates how these records are chosen:
281+
282+
- `standard`: This strategy fetches records from the org in the same order as they appear, respecting any filtering applied via `selection_filter`.
283+
- `similarity`: This strategy is employed when you want to find records in the org that closely resemble those defined in your SQL file.
284+
- `random`: As the name suggests, this strategy randomly selects records from the org.
285+
286+
#### Selection Filter
287+
288+
The `selection_filter` acts as a versatile SOQL clause, providing fine-grained control over record selection. It allows filtering with `WHERE`, sorting with `ORDER BY`, limiting with `LIMIT`, and potentially utilizing other SOQL capabilities, ensuring you select the precise records needed for your chosen `selection_strategy`.
289+
253290
### Database Mapping
254291

255292
CumulusCI's definition format includes considerable flexibility for use

0 commit comments

Comments
 (0)