From e17d4552af56797326c2551fe0c4815b3e95ca82 Mon Sep 17 00:00:00 2001 From: Paul Prescod Date: Wed, 14 Jul 2021 21:01:43 -0700 Subject: [PATCH] Small docs fixes --- docs/index.md | 3 ++- docs/salesforce.md | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/index.md b/docs/index.md index dfc5a71d..03d49587 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1496,6 +1496,8 @@ Snowfakery to "enrich" your real or pre-generated data with fake data. CumulusCI can also be used to download CSV data for enrichment as follows. +Snowfakery also has [built-in features](salesforce.md#incorporating-information-from-salesforce) for querying SOQL so you may also want to evaluate those as an alternative to this technique. + `CumulusCI.yml`: ```yaml @@ -1533,7 +1535,6 @@ CumulusCI can also be used to download CSV data for enrichment as follows. Of course you will need to adjust the paths based on your directory structure. -Snowfakery will soon have built-in features for querying SOQL so you may also want to evaluate those as an alternative to this technique. #### Iterating over SQL database datasets diff --git a/docs/salesforce.md b/docs/salesforce.md index a25ee575..6894cbe0 100644 --- a/docs/salesforce.md +++ b/docs/salesforce.md @@ -54,10 +54,14 @@ $ cci flow run test_everything ## Incorporating Information from Salesforce There are various cases where it might be helpful to relate newly created synthetic -data to existing data in a Salesforce org. For example, that data might have -been added in a previous CumulusCI task or some other process. +data to existing data in a Salesforce org. Perhaps that data was added +in a previous CumulusCI task or some other process. If your use cases are +intensive, please remember to read the section +[A Note On Performance](#a-note-on-performance) -For example, if you have a Campaign object and would like to associate +### SalesforceQuery.find_record and SalesforceQuery.random_record + +Let's use an example where you have a Campaign object and would like to associate Contacts to it through CampaignMembers. Here is an example where we query a particular Campaign object: @@ -113,6 +117,11 @@ NOTE: The features we are discussing in this section are for linking to records that are in the Salesforce org _before_ the recipe iteration started. These features are not for linking to records created by the recipe itself. +In extremely large loads, CumulusCI can be configured to upload "portions" or "batches" of +records from the recipe. Previous portions _are_ in the org and therefore can be queried. + +### Querying Field Data + Sometimes we want to do more than just link to the other record. For example, perhaps we want to create Users for Contacts and have the Users have the same name as the Contacts. @@ -152,6 +161,8 @@ have Contacts, but you can see how you would connect a synthetic object to a pre-existing object, while also getting access to other fields. +### SOQL Datasets + If you would like to use Salesforce query as a Dataset, that's another way that you can ensure that every synthetic record you create is associated with a distinct record from Salesforce. @@ -340,3 +351,12 @@ Files can be used as Salesforce ContentVersions like this: FirstPublishLocationId: reference: Account ``` + +### A Note On Performance + +Calling into Salesforce is much slower than most things you do in +Snowfakery. The network traffic alone is comparatively slow. + +Consider using [variables](index.md#defining-variables) to "remember" +data you've queried, and if you need to pull down a lot of data, use +a SOQL Dataset which will intrinsically cache the data for you.