Skip to content

Commit 6889461

Browse files
Update document with new enhancements
1 parent db230ce commit 6889461

1 file changed

Lines changed: 71 additions & 16 deletions

File tree

docs/data.md

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -252,40 +252,95 @@ versa.
252252

253253
### Selects
254254

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.
255+
The `select` functionality is designed to streamline the mapping process by enabling the selection of specific records directly from Salesforce for lookups. This feature is particularly useful when dealing with non-insertable Salesforce objects and ensures that pre-existing records are used rather than inserting new ones. The selection process is highly customizable with various strategies, filters, and additional capabilities that provide flexibility and precision in data mapping.
256256

257257
```yaml
258-
Select Accounts:
258+
Account:
259259
sf_object: Account
260-
action: select
261-
selection_strategy: standard
262-
selection_filter: WHERE Name IN ('Bluth Company', 'Camacho PLC')
263260
fields:
264261
- Name
265-
- AccountNumber
266-
Insert Contacts:
262+
- Description
263+
264+
Contact:
267265
sf_object: Contact
268-
action: insert
269266
fields:
270267
- LastName
268+
- Email
271269
lookups:
272270
AccountId:
273271
table: Account
272+
273+
Lead:
274+
sf_object: Lead
275+
fields:
276+
- LastName
277+
- Company
278+
279+
Event:
280+
sf_object: Event
281+
action: select
282+
select_options:
283+
strategy: similarity
284+
filter: WHERE Subject IN ('Sample Event')
285+
priority_fields:
286+
- Subject
287+
- WhoId
288+
threshold: 0.3
289+
fields:
290+
- Subject
291+
- DurationInMinutes
292+
- ActivityDateTime
293+
lookups:
294+
WhoId:
295+
table:
296+
- Contact
297+
- Lead
298+
WhatId:
299+
table: Account
274300
```
275301

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.
302+
---
303+
304+
#### Selection Strategies
305+
306+
- **`standard` Strategy:**
307+
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.
308+
309+
- **`similarity` Strategy:**
310+
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.
311+
312+
- **`random` Strategy:**
313+
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.
314+
315+
---
316+
317+
#### Selection Filters
318+
319+
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.
320+
321+
---
322+
323+
#### Priority Fields
324+
325+
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.
326+
327+
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.
328+
329+
---
330+
331+
#### Select + Insert
277332

278-
#### Selection Strategy
333+
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.
279334

280-
The `selection_strategy` dictates how these records are chosen:
335+
- **Select Records:**
336+
If a record from your SQL file has a similarity score below the threshold, it will be selected from the target org.
281337

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.
338+
- **Insert Records:**
339+
If the similarity score exceeds the threshold, the record will be inserted into the target org instead of being selected.
285340

286-
#### Selection Filter
341+
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.
287342

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`.
343+
---
289344

290345
### Database Mapping
291346

0 commit comments

Comments
 (0)