Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small docs fixes #444

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
26 changes: 23 additions & 3 deletions docs/salesforce.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.