Salesforce-Data-TreecipeSalesforce-Data-Treecipe is a Visual Studio Code extension designed to streamline the process of generating production-like data during development in order to support building Quality in. This extension auto-generates a recipe yaml file based on the running, local project structure. Said differently, what is already in the "source" for the project. From the generated "Fake-Data Generating YAML Files", additional commands can be used following the recipe generation to build Collections API datasets that can be committed and reused as needed. Users have two choices of "Fake Data" implementations:
Table of Contents
Prerequisites for SnowfakeryIf using snowfakery as Faker service instead of faker-js."faker-js" can be natively installed with VS Code extensions and does not require machine setup steps. VS Code Extension Installation
"How To" YouTube Walkthroughs:Get started by walking through the below commandsNote: press Or use the Treecipe side bar. Click the Treecipe icon in the Activity Bar (a tree of nodes on a round base) to see every command below in two groups, Recipes and Picklist Dependencies. Each row runs the same command the Command Palette does, so every prompt and preview opt-in still applies. In a folder with no Treecipe configuration yet, the view offers an Initiate Configuration button instead; once the file is written the list appears without a reload. Opening the view only reads where the configuration is: it loads no run, contacts no org and runs no
Note: Select Faker Implementation is also available from the Command Palette at any time to switch between the 1. Salesforce Treecipe: Initiate Configuration FileThis command initiates the creation of a configuration file that is required before using other features of the extension. The command creates a root directory folder called "treecipe" and within it a configuration file called "treecipe.config.json". This file is auto generated based on the field configurations detailed selection made when prompted "Select objects directory". The end result treecipe.config.json file is expected to look like the below:
How It Works:
Once the configuration file is generated, you can begin using the Generate Treecipe command. Optional:
|
| Emitted line | Catches |
|---|---|
expectAtLeast('USA', new List<String>{ 'Ohio', 'Texas' }) |
A value removed from the combination |
expectNotAllowed('USA', new List<String>{ 'Ontario' }) |
A value that drifted into the combination |
expectNone('Antarctica') |
A controlling value that must unlock nothing gaining values |
The forbidden list is the complement: every value the dependent field declares that this controlling value does not unlock. That is deliberately weaker than expectExactly — a value an admin legitimately adds to the field after generation is tolerated, while a value moving into the wrong bucket still fails. Tightening a line to expectExactly is a deliberate edit — note that regenerating overwrites the file, so hand edits are lost.
Record type scoped specs
A record type assigns its own subset of picklist values to the controlling and dependent fields, so the combinations reachable through one record type are narrower than what the field itself declares. Where an object has a recordTypes/ directory, the per-object class gets those narrowed combinations too, alongside the field-level ones. The sample below shows the shape of what is emitted rather than metadata you should expect to see:
public static SDTPicklistDependencySpec specFor_Dependency_Example_c_Neighborhood_c_recordType_Cleveland_Only() {
return SDTPicklistDependencySpec.forRecordType('Dependency_Example__c', 'Neighborhood__c', 'Cleveland_Only')
.controlledBy('City__c')
.expectAtLeast('cle', new List<String>{ 'ohiocity', 'tremont' })
.expectNotAllowed('cle', new List<String>{ 'willowick' })
.expectUnavailable('eastlake');
}
- The controlling values are the field's, intersected with what the record type assigns to the controlling field; the unlocked values are intersected with what it assigns to the dependent field
- A controlling value the record type does assign but whose unlocked values it assigns none of becomes
expectNone— it must exist under that record type and unlock nothing - A controlling value the record type does not assign becomes
expectUnavailable— under that record type the value is absent rather than empty, andexpectNonewould demand it exist - A field the record type's XML never mentions is treated as unassigned for that record type, not as fully assigned: the combination is skipped and reported as a warning, and the field-level spec still covers the field
- The scoped specs are collected by
recordTypeSpecs()on the per-object class andSDTPLDSpecs.allRecordTypeScoped()on the aggregator
They are not asserted by SDTPLDSpecsTest, and that is deliberate. Apex Schema describe returns picklist values without any record type filtering, so the describe-backed source cannot answer a record-type-scoped spec — it rejects one outright rather than checking it against the whole field and reporting a scope it never verified as green. The scoped specs deploy with the rest of the contract and are ready for an ISDTPicklistDependencySource that can read record-type-filtered values; until then they are a captured contract, not a running one. An object with no recordTypes/ directory generates exactly what it did before.
Chained dependencies
Where a dependent picklist is itself the controlling field of another (Country__c → State__c → City__c), the generated spec for the lower link carries a dependsOn naming the spec above it:
public static SDTPicklistDependencySpec specFor_Chain_Example_c_City_c() {
return SDTPicklistDependencySpec.forField('Chain_Example__c', 'City__c')
.controlledBy('State__c')
.dependsOn(specFor_Chain_Example_c_State_c())
.expectAtLeast('Ohio', new List<String>{ 'Cleveland', 'Columbus' })
.expectNotAllowed('Ohio', new List<String>{ 'Austin', 'Toronto' });
}
When the upstream spec fails, the break is reported once where it actually is, and the downstream spec reports a single UPSTREAM_FAILURE naming the spec to fix first — rather than repeating the same describe mismatch for every dependent below it.
Notes:
- A field with a
controllingFieldbut novalueSettingsmarkup is reported as a warning and skipped; the rest of the run continues - A record type that assigns no values to the controlling or the dependent field of a dependency is reported the same way, and only that combination is skipped
- If no dependent picklists are found, an informational message is shown and no file is written
- If the generated classes already exist, you are prompted before they are overwritten
- A per-object class left over from an object that no longer declares a dependent picklist is removed and named in the summary, so the org stops asserting a contract your metadata no longer describes
- Upgrading from 2.12.x–2.14.x: the Apex classes were unprefixed then. If a
PicklistDependencyFrameworkfolder or anSFTreecipePicklistDependencySpecs.clsis still in your project, the command warns and names what to delete — locally and in any org you deployed them to. Nothing is deleted for you
The generated assertions read the org's real metadata. Schema describe is not isolated by @IsTest, so no test setup data and no SeeAllData are involved.
End-to-end in one command
After generating, the command offers to deploy and run the tests against an org right away. Accept it and you are prompted for the target org, the classes are deployed, the tests run, and the results land in the output channel and the treecipe directory — generation through to verified results without leaving the command.
The offer comes after generation rather than before, because generating is useful on its own: reviewing what changed, or working without an org to hand, needs the files and nothing else. Dismissing the prompt leaves you with a completed generation, not a cancelled command.
This path always deploys, unlike "Run Picklist Dependency Check" below, which deploys only when the test class is missing. The classes were just rewritten, so the org copy is stale by definition — a conditional deploy would run yesterday's contract against today's metadata.
Once generated, you can also run the check any time with "Run Picklist Dependency Check" below, and browse the structure it generated with the Explorer.
Once the classes are in your org
Everything above is the VS Code side. For the org side — what each deployed class is, how to read a generated spec against the Field Dependencies grid in Setup — including which argument is which, and how a record-type-scoped spec differs from the field-level one — how to run the tests from Setup or the Developer Console, how to trigger a failure on purpose to prove the gate works, and how to decide whether to fix the org or regenerate the specs — see the Picklist Dependency In-Org Guide. It is written for an admin or developer looking at SDTPLDSpecsTest in an org, and assumes nothing about this extension.
6. Salesforce Treecipe: Run Picklist Dependency Check
This command deploys and runs the generated picklist dependency tests against an org and reports the result in VS Code.
Prerequisite: "Generate Picklist Dependency Tests" must have been run, and the Salesforce CLI (sf) must be installed with at least one authorized org.
The command:
- Lists your connected orgs and prompts you to pick the target (see Which orgs the pickers list)
- Checks whether the
SDTPicklistDependencyTestssuite in that org still containsSDTPLDSpecsTest, and offers to deploy if it does not — nothing is deployed without explicit confirmation. Membership is what is checked rather than the suite's existence: a suite whose member class was deleted still exists, and running it would pass having asserted nothing - Runs the
SDTPicklistDependencyTestssuite through the Tooling API (nosfprocess) and waits up to 10 minutes for it to finish. Cancel aborts the test job in the org and says whether it was aborted; a run still going after 10 minutes is left running there and nothing is written - Writes a per-method report to the Picklist Dependency Check output channel and shows a pass/fail summary notification
- Saves the results into
treecipe/PicklistDependencyResults/check-<org>-<timestamp>/asresults.jsonandreport.md
A failing method names the object, field, controlling value, and the specific missing values.
Notes:
- If no orgs are authenticated, you are told how to authorize one rather than shown an empty picker
- Declining the deploy prompt exits cleanly and deploys nothing
- The output channel is cleared on each run, so what you see always belongs to the run that just finished
- Because the channel is cleared, every run is also written to disk under
treecipe/PicklistDependencyResults/— one timestamped folder per run, so results stay committable and diffable between runs. Passing runs are saved too, not only failures
7. Salesforce Treecipe: Open Picklist Dependency Explorer
This command opens a read-only visual view of your picklist dependency structure. It answers "which controlling value unlocks what" without you reading generated Apex or a markdown dump.
It is a picture of the structure, and only that. The panel reads no check results: no pass/fail badges, no status filter, no last-run banner, and no links into a generated .cls or a run's report.md. Whether your org still agrees with the structure is what "Run Picklist Dependency Check" answers, and it reports that in its own output channel and report.
Prerequisite: run Generate Picklist Dependency Tests first. The panel renders the spec manifest that command writes, so what you see is exactly what your generated tests assert. No org, no CLI and no check run are required — and if you have not generated yet, the panel offers a metadata preview instead (see below).
The command:
- Reads
treecipe/PicklistDependencySpecs/manifest.json— the machine-readable description of the specs that were generated — and builds the dependency structure from it: object → controlling field → controlling value → the values it unlocks, and the values it must not unlock. Your source metadata is not re-walked, so a panel row always corresponds to a spec method that exists - Renders chained dependencies as a connected graph — a field controlled by another dependent picklist is nested under it rather than repeated as a flat row
- Lists any field the generator skipped as its own row marked not covered, with the reason — rather than leaving it out, where it would be indistinguishable from a field with no dependency
- Clicking any combination reveals the generating field's source XML path, with a Reveal in Explorer action that opens the
.field-meta.xml, and a Copy reference action - Nests each record type's narrowed combinations under the field they narrow, collapsed until you open them — the same dependency as the record type actually exposes it
The panel names no Apex. Which class or spec method was generated is not a fact about a dependency, so it is not on screen — it is in manifest.json and in the generated .cls files themselves.
Finding your way around a large org:
A toolbar sits above the structure:
- Find object, field or controlling value matches on object, field, controlling field, record type, and the controlling value heading every combination row — everything the panel actually shows you, and nothing it does not. Searching for a field name reaches the object holding it, so you do not have to know which object that was; searching for
Canadareaches every object with a row that says whatCanadaunlocks — and when exactly one object matches, it opens by itself. The values a combination unlocks are not matched: a value is findable where it is a controller, which in a chain means one level down. A value only a dropped row carried is not matched either — the haystack is rebuilt from what survived the ceiling, so a match always has a row on screen to show for it - Contents lists every section and object the panel is showing, and scrolls to any of them
- Expand all / Collapse all, bounded at 25 visible objects — past that the panel asks for a narrower filter rather than freezing
Filtering only ever hides rows. Nothing about a row is recomputed, and nothing is inferred from a row being hidden.
Copy reference on any combination copies its stable key — Object__c.Field__c [RecordType] @ Controlling Value — and pasting that back into the find box reopens exactly that combination. It is stable across re-renders, so it is something you can put in a review comment or a ticket.
Notes:
- The panel is a VS Code webview — no local HTTP server, no open port, no extra runtime dependency. Its content security policy allows only the extension's own inline style and script, so it loads nothing from the network
- Built as you open it. An object's rows are built when you expand it, not when the panel loads, and the model itself is bounded: at most 250 objects, 25 dependent picklists per object, 200 combinations per field, 25 record type scopes per field, 200 declared values per field, and 20,000 rendered combinations in total. Anything the ceiling drops is counted and stated in a notice at the top. What survives a cap is whatever the manifest declares first — the same order on every axis, so the same manifest always truncates to the same rows and a row you cannot find was cut rather than moved. Dependency chains are capped whole rather than field by field, so an object can show more dependent picklists than the per-object limit suggests; the notice says so. The one exception keeps an object carrying a skipped field past the cap, since that is the only row nothing asserts
- Where a field declares more values than the panel renders, the "must not unlock" list is withheld rather than shortened — a complement drawn against a partial list would understate what the spec forbids, and the row says so
- It follows your active color theme, light, dark or high contrast
- No org, no CLI, no check run? None of them is involved. The panel renders from
manifest.jsonon disk and nothing else, so it works the same in a fresh clone as in a workspace that runs the check nightly - Not generated yet? You get a message naming the generate command, plus a "Preview from metadata (not generated)" action. The preview scans your source metadata exactly as previous versions did, and banners every row as read straight off the XML rather than from a generated manifest
- A corrupt
manifest.json? The parse failure is reported and the same preview is offered — never a blank panel - Metadata changed since you generated? The panel says so in a banner naming the generate command, and keeps showing what the generated Apex actually asserts. It never silently re-derives the structure from metadata your tests have not been regenerated against
- No dependent picklists at all? You get an empty state naming the objects directory that was scanned
- Record-type-scoped rows are the same dependency, narrowed. Each scope says so beside its own rows rather than relying on a note elsewhere in the panel, and a value the record type does not assign is shown as not available rather than as unlocking nothing, which is a different claim
- Scoped combinations are counted separately in the header (
N combination(s) + M record-type-scoped), because a record type narrows a field-level dependency rather than adding one of its own - Commit
manifest.jsonalongside your generated.clsfiles. It is the record of what was generated, and reviewing it as a diff shows dependency changes in the same commit as the Apex that asserts them
8. Salesforce Treecipe: Update Picklist Dependency Metadata from Specs
This command runs opposite to Generate. It reads your generated Apex specs — including whatever you edited into them — and reconciles your source metadata to match, so you can deploy the change and watch a failing dependency check go green.
Prerequisite: Generate Picklist Dependency Tests must have been run, so there are specs to read.
Why it exists. The check tells you Account.Region__c @ cle: missing [plant]. That failure is indexed by controlling value; your metadata is indexed by dependent value. So unlocking plant under cle means editing the plant block — nowhere near where the message points. That transpose is what this command does for you.
The command:
- Reads every generated
SDTPLDSpecs_<Object>.clsand parses the specs back out - Transposes each one into the
valueSettingsshape your metadata stores - Shows you every pair it would add or remove, in the words the failure used —
cle unlocks plant— before writing anything - Writes only if you approve; declining leaves every file untouched
- Offers to deploy the changed files to an org. Declining says explicitly that the changes are in your working tree and were not deployed
Notes:
- Your spec's silences are respected. A spec asserts what a controlling value must unlock and what it must not. Anything it names neither way — and any controlling value it never mentions — it makes no claim about, and the command leaves it alone.
expectNoneandexpectExactlyare the exception: both state their list completely, so anything else under that controlling value is removed - Your formatting survives. Only the
valueSettingsregion and, where needed,valueSetDefinitionare rewritten. The XML declaration, indentation, unrelated markup and trailing newline are preserved. Both<valueSettings>layouts are supported and whichever your file uses is kept - Reconciling twice changes nothing the second time, and after a writeback, running Generate produces byte-identical Apex — the two directions agree
- The controlling field is reconciled too. A
valueSettingsentry can only name a controlling value the controlling picklist actually offers, so when a spec asserts a value that field does not declare, it is added to that field's ownvalueSetDefinitionin the same run — otherwise the write would describe a combination nobody can reach, and you would find out on deploy - A global-value-set-backed field can be rewired, but adding a new value is refused with a message naming the set to add it to first. The shared
.globalValueSet-meta.xmlis never edited — its blast radius reaches every field pointing at it. The same rule applies to a controlling field - An orphaning cascade — removing a value that is itself another picklist's controlling field — names the downstream field and skips that field. Every unaffected field still writes
- A spec class that cannot be parsed aborts naming the file and writes nothing. An unparseable class is never treated as "this object has no dependencies"
- Record-type-scoped specs are not written back. A record type narrows what it exposes; applying that to
valueSettingswould assert the narrowing against every record type
9. Salesforce Treecipe: Open Recipe Cockpit (preview)
A panel for browsing a generated recipe (every object, every field, the field's type and the faker expression behind it, with a search on every tab and one-click jumps into the recipe file), for generating a relationship tree with the record counts you choose and inserting it into a sandbox or scratch org, and for assigning the tree's permission sets to your user in that org.
Prerequisite: Generate Treecipe must have been run at least once. With no generated run the panel says so and names that command.
What the cockpit changes, and where it keeps it. Click ? at the right of the cockpit's toolbar. It explains where the recipes come from, which settings change what is generated without editing the recipe file (excluded objects, unticked fields, record counts, fixed values, faker bounds, the rules box), which buttons do edit it, and where the settings are kept. It also lists each card that differs from its recipe file right now. Open the full guide opens the Recipe Cockpit guide, which says the same with screenshots.
One click from the status bar. In a workspace that contains treecipe/treecipe.config.json, the extension starts when the window loads and puts a tree icon and Treecipe on the left of the status bar (tooltip Open Recipe Cockpit). Clicking it runs this same command, so the preview opt-in below still applies and an open panel is brought to the front rather than opened twice. Showing it loads no run, contacts no org and runs no sf command. Hide it with salesforce-data-treecipe.showRecipeCockpitStatusBarItem (on by default); the change takes effect without a reload. In a folder without that file, the item appears once any Treecipe command has started the extension.
It is a preview. The first time you run it in a workspace, a warning asks you to opt in. The switch is salesforce-data-treecipe.recipeCockpitEnabled, written for this workspace only, and you can turn it off in Settings. What is built and what is still missing is tracked under the recipe-cockpit label. It writes back into a recipe only three changes, and asks first each time: a friend added under a self-lookup iteration with +, a TODO lookup wired to a nickname with Wire to…, and a lookup's standard parent added with Add <Parent> to recipe.
How it works:
- It reads what Generate Treecipe already wrote. Every run leaves a
treecipeObjectsWrapper-<timestamp>.jsonnext to its recipe files undertreecipe/GeneratedRecipes/. The panel reads that file rather than re-parsing your metadata, and opens on the latest run - It opens on Recipe Trees: one card per relationship tree, titled by the folder the tree was written to (
Account-thru-Contact,Lead-ONLY: its first object thru its last, in insert order) unless you renamed it, and its object and field counts. A card's Treecipe tab lists its objects in insert order, each with the lookups tying it to a parent in the same tree, such as(AccountId → Account)(a self-lookup shows as(ParentId)). An object written twice, such as a self-lookup's nested child iteration, is listed twice: once with its own nickname, and once more asAccount_child_NickName · nested under Account_NickName, whose↗ ymllinks open the nested occurrence's lines. A self-lookup iteration in a faker-js recipe has a +: it lists the friends the Account above it carries that the iteration does not (for example+ Contact,+ Opportunity), and choosing one adds that friend under the iteration'sfriends:block, one per click, after you confirm. The friend's block is copied from the one under the Account above, its ownfriends:left out, with a nickname of its own (Contact_child_NickName) and its lookup to the Account pointed atAccount_child_NickName, so Run Faker by Recipe gives each child Account its own Contacts. Every other line of the recipe is left exactly as it was, and the cockpit reloads with the new friend listed under the iteration. Field rows show the type with its size (Text(50),Currency(18,2)), a dependent picklist says what controls it, and↗ ymlopens the recipe at the field's line. A picklist row expands to its values, grouped per record type. Runs generated before sizes were recorded show the bare type. A run whose wrapper has no tree data shows one card per recipe file and says so - Each card has up to four tabs: Treecipe · Previously Used Data Sets · Troubleshooting · Query. Treecipe is selected when a card opens, Previously Used Data Sets appears only when the tree has a history, and Troubleshooting and Query appear on every card with a tree folder. Each data set row names the version of the tree it came from: current version, version of <date>, or version unknown
- The Query tab runs the tree's SOQL. It lists the queries Generate Treecipe wrote to the tree folder's
soql-sosl-templates--<tree>-<timestamp>.md: for each object, its base query, its child-to-parent and parent-to-child queries and one per record type (the SOSL template is not listed). Each query is a text box you can edit; the edit is kept for this workspace, and Reset puts back the generated text. Run… checks the text is oneSELECT, then asks for the org in the command palette every time, over every connected org, production included, because a query only reads. It reads up to 50,000 records or 1,000,000 values, whichever comes first, shows the first 50 rows and 50 columns under the query, and says how it went in a notification. An edit is kept only while Generate Treecipe still writes the same query it was made from. Export JSON and Export CSV write what the last run returned to the tree'sGeneratedRecipes/<run>/<tree folder>/RunArtifacts/QueryResults/, which carries a.gitignore(an export into that folder warns if its.gitignoredoes not ignore everything), and offer Open file. In the CSV, a parent's fields are columns such asAccount.Name, a subquery is one column of JSON, and a cell a spreadsheet would run as a formula starts with' - The Record types section sits in the Treecipe tab, under its search box and above the tree's objects, on a card that lists an object with two or more record types. It is opened by the Manage record types button, in the tile under the search box beside the two filter checks (Click to show record type impacted fields only, Click to show fields with open TODOs); the button's note says, for example, 1 object · generated by default (or changed once your ticks differ from the run), and the section opens under the tile. On a card with no object of two or more record types the button is disabled and says why. The Treecipe search also narrows it. It lists each record type, says which ones the run on screen generated, and shows which picklist fields each one restricts. Tick the record types to generate, in order: the next Generate fake data and insert uses them. When an object has more than one ticked, or one that is not its default, the confirmation offers One data set with the record types folded together: each record type gets its own records, with its own children and picklist values. The recipe for that data set is built from your object metadata and kept in the data set's
BaseArtifactFiles; no new run is written, so what was written into the recipe file (lines edited by hand, lookups wired on the card, parents or friends added on it) is not in it. An object's RecordTypeId is generated whenever it has record types ticked, even if the card unticks it. Tick Remember this selection to save the choice intreecipe.config.jsonwhen the data is generated, so Generate Treecipe reuses it (seerecordTypeSelections). It starts unticked, and without it the choice is used for that data set only. - The Treecipe tab is where a data set is built: what is generated, how many records, and where it goes. Its top holds, in order:
- Choose org…: the org the generated data goes to. It is one selection for the whole panel, drawn in every card's Treecipe tab, with the org's type, ⟳ Refresh orgs, + New scratch org and Authorize org. It lists sandboxes and scratch orgs, plus the Salesforce CLI's default org (
target-org), which comes first and reads(default). A default org that turns out to be production can be chosen, but nothing is ever inserted into it. It checks the org connections the first time you use it or open a Treecipe tab, never when the panel opens. While the check runs the dropdown stays in place showing the last org you picked, or else the default, with a spinner beside it, and every tree generates only until the check answers. The last org you picked is preselected the next time, without connecting - Wire TODO lookups (N)
- Generate fake data and insert, which reads Generate fake data and insert into <org> once an org is chosen, with Reset Selections to its right
- Assign permission sets to me…
- Generate permission set…
- Choose org…: the org the generated data goes to. It is one selection for the whole panel, drawn in every card's Treecipe tab, with the org's type, ⟳ Refresh orgs, + New scratch org and Authorize org. It lists sandboxes and scratch orgs, plus the Salesforce CLI's default org (
- Below them is the tree itself: object icons and field checkboxes, picklist rows,
↗ yml, + on a self-lookup iteration, and the tab's search box - Wire to… resolves a
### TODO -- REFERENCE ID REQUIREDlookup in the recipe file. It is drawn on a lookup row whose value is still that TODO (every lookup of a snowfakery recipe, and the ones a faker-js recipe could not wire), when the tree holds a parent record inserted before it: an object the lookup's object is nested under, or one at a lower relationship level. It writes that parent's nickname as the lookup's value (AccountId: Account_NickName), which the insert replaces with the Id of the record holding it. When more than one record could be named, it asks which. Wire TODO lookups (N) does it in one go for every lookup of the tree with exactly one choice. Both confirm first, change only those lines of the recipe, and refuse if the file changed since it was drawn. A self-lookup's top record, a lookup cycle and a parent with no recipe stay TODOs: no record is inserted before them to point at. Unlike counts and selections, this does change the recipe file, so every later run of it uses the reference - Add <Parent> to recipe adds a lookup's standard parent to the recipe file. It is drawn on a TODO lookup row whose one parent is a standard object the recipe does not write yet (Account, Contact, Lead, Opportunity or Case) and that Generate Treecipe placed at a lower relationship level. It writes a new top-level block for the parent, with a nickname of its own,
count: 1and only its minimum required fields (AccountName; ContactLastName; LeadLastNameandCompany; OpportunityName,StageNameandCloseDate; Case none), using values from the recipe's own faker backend. It then wires the lookup to that nickname, so the tree generates and inserts its own parent first. It confirms first, changes nothing else in the file, and refuses a custom object, a polymorphic lookup, a parent the recipe already writes, and a file changed since it was drawn. The fields come from the template alone: a required field your org adds to the parent shows in the insert's errors - A count box sits right of each object's name. It starts at the recipe's own
count. A top-level object's box is its record count. A friend nested under another object in a faker-js recipe is labelledper <Parent>: its count is records per parent record, so 2 Accounts with3per Account gives 6 Contacts. A snowfakery recipe is flat, so every box is a plain count. Any whole number of 1 or more is accepted; anything else (0,2.5,1e2, an empty box) is refused on the row. An excluded object's box is disabled, and re-including the object brings its count back. Counts never touch the recipe file: they are kept per tree folder for this workspace, beside the excluded objects and unticked fields, and the generate button applies them to a filtered copy.datasetSource.jsonrecords the counts a data set was generated with. Reset selection also puts every count back to the recipe's own - One button generates, and inserts when it can. It is never disabled except while its own tree is generating or inserting; another tree can generate meanwhile. It generates the tree exactly as Run Faker by Recipe does (the same data set folder, filtered copy and
datasetSource.json) and, when it reads Generate fake data and insert into <org>, then inserts it parents first, so each child's lookups name the parents inserted in the same run:- It inserts only while a sandbox or scratch org is selected and every object the tree inserts is ready for it. Otherwise it reads Generate fake data, generates only (with Run Faker by Recipe's own confirmation) and says why beside it, as
Generates only: <reason>: no org chosen, an org that is not a sandbox, an object the org does not have or will not let you create, an unticked field the org requires, a required lookup that can point at more than one kind of object, another tree being inserted, or a scratch org run or permission set assignment still running. A recipe field the org does not have, or will not let you set, does not stop the insert: the records carrying it fail when they are inserted, and the insert's notification and its View errors show which - A confirmation lists each object with its total record count. Above 2,000 records it also warns that the run will take time and names the total and the number of Collections API requests. Generate only writes the same data set and inserts nothing; Cancel generates and writes nothing
- It then inserts the way Insert Data Set by Directory does, because both use the same insert: you choose all-or-none, every file is inserted in 200-record requests (and in rounds when its records reference each other), the progress notification names each object and round, and Cancel deletes every record that insert saved, as an all-or-none failure does. The results are written to the data set's
InsertAttempts/folder. When the insert ends, a VS Code notification says how many records were inserted and how many failed, with View errors (when any failed or the insert stopped) or View results, either of which opens that file. The card itself draws no result line, so nothing on it moves - The org is asked again, on the connection used to insert, whether it is a sandbox before anything is generated. A lookup the recipe could not wire to a parent in the tree (a snowfakery
### TODO) is pointed at a parent record inserted in the same run. A lookup in an object's recipe to an object the tree does not insert gets its own searchable picker after the confirmation: Random parent, the records you search for by name and check (several are given out in turn, record by record), or Leave blank for an optional lookup. Only records that lookup's own search returned can be used, and cancelling any picker generates and inserts nothing. A required lookup to an outside object that the recipe does not carry gets a random existing record of that object; if the org has none, nothing is generated or inserted - The result shows beside the button, and the new data set is added to the card's Previously Used Data Sets without redrawing the rest of the cockpit, so the selected org and its checks stay as they were
- Open in browser, beside the selected org, logs you in to that org in your browser. It asks Salesforce, over the selected org's own saved authorization and without the Salesforce CLI, for a ONE-TIME login address (the single-access frontdoor
sf org openuses), and hands thathttps:address to VS Code, which opens it in your browser, Remote and WSL included. The address never carries the org's access token, so the token does not end up in your browser history, and the address itself is never saved, logged or shown in the panel. If it cannot be opened, one notification says why in fixed words - + New scratch org, beside the org picker, sets up a disposable org to insert into without leaving VS Code. It first asks which Dev Hub to use, every time, even when only one is authorized: the list holds the authorized orgs the Salesforce CLI marks as a Dev Hub (
isDevHub) that answer when checked, with the CLI's default (target-dev-hub) listed first and labelled "(default)" but never chosen for you; with none, it says to runsf org login web --set-default-dev-hub. It uses the Dev Hub you picked and the project'sconfig/project-scratch-def.json(it still needs a readablesfdx-project.jsonwith package directories that exist, sincesfruns from the project folder); it then asks for the scratch org's alias (there is no default; letters, digits and. _ + -, starting with a letter or digit, not ending with., no@, and not a Windows device name such asCON), and warns, without refusing, when another authorized org already holds that alias, since the CLI will move it to the new org. It then asks how many days the org lives: a whole number from 1 to 30 (Salesforce's maximum), with 7 filled in, so Enter keeps the usual week; Escape cancels. A confirmation names all of that first, and Cancel or Escape runs nothing. It then runssf org create scratchunder a cancellable notification that shows the phase, and nothing else: it deploys nothing to the new org (#358), so the org starts empty and you deploy what you need yourself. When a scratch org was created, the cockpit checks the org connections again, lists it and selects it. How the run ended is a VS Code notification (nothing is drawn under the picker). A created org's notification carries Copy deploy command (sf project deploy start --target-org <username>on the clipboard, never run) and View output, which opens the CLI's JSON result saved undertreecipe/OrgOperations/<username>/(<alias>/when no org was created, on a failed create). The confirmation also names what the repository decides: where the Dev Hub setting came from when you picked the default, and the definition's edition, admin email and username. Saved results have the org's credentials redacted, andOrgOperations/carries a.gitignore.sfis run from where it is installed on PATH, never from inside the workspace. The cockpit never deletes an org; delete one yourself withsf org delete scratchwhen you are done with it - Authorize org, beside + New scratch org, logs in to a sandbox that already exists without leaving VS Code or starting the Salesforce CLI. It asks for the sandbox's subdomain, such as
acme--qa, the part of its login address before.sandbox.my.salesforce.com(its login page's address works too), and for an alias, which can be left empty, then opens the Salesforce login page in your browser and saves the org with your other CLI authorizations. Its confirmation has one box, Make this my selected target org and this workspace's default org: ticked, the org is selected in the cockpit and set astarget-orgin this workspace's.sf/config.json; unticked, it is only added to the list. An org that is not a sandbox or scratch org is authorized, but it is never selected or made the default, and it does not get the alias. The login waits five minutes, and can be cancelled from its notification; if you had already logged in when it stopped, the org may still be authorized, and the notification says so.
- It inserts only while a sandbox or scratch org is selected and every object the tree inserts is ready for it. Otherwise it reads Generate fake data, generates only (with Run Faker by Recipe's own confirmation) and says why beside it, as
- Assign permission sets to me… is on every tree card's Treecipe tab, whatever the org answered. It lets your user in the org see the tree's objects and fields; without it the insert fails on field-level security. It offers the project's own permission sets (
*.permissionset-meta.xmlunder the package directories ofsfdx-project.json) whose object or field permissions name any of the tree's objects, in a multi-select pick that says what each one covers and marks it partial when it leaves some of the tree's objects out. A file that cannot be read as a permission set is skipped with a warning, and when nothing covers the tree a warning says so and nothing runs. It uses the org chosen above, once that org has answered that it is a sandbox and its check has finished; with no org chosen it asks you to pick one from the same list (sandboxes and scratch orgs only), and the org you pick becomes the one chosen above once you confirm. A confirmation names the tree, the org, the user and every pick; Cancel runs nothing. The org is then asked again whether it is a sandbox, and which of the picks it already holds. It deploys nothing: a pick the org does not hold is named in a warning telling you to deploy it (withsf project deploy startor your usual deploy), and only the picks the org holds are assigned to the user the org is authorized as, and no one else, by inserting theirPermissionSetAssignmentrecords directly over the org connection in one request (no Salesforce CLI process). When the org holds none of them, nothing is sent. Choosing more than 200 permission sets is refused, and nothing runs. A permission set the user already holds counts as assigned. The assignment has no Cancel, since one request cannot be taken back once sent. Every outcome is a VS Code notification rather than a line on the card: a success is an information message, and everything else (a partial assignment naming which failed, a timeout or an unanswered request, after which which were assigned is unknown) is a warning. The warning's View output button opens the result, saved under the tree'sRunArtifacts/OrgOperations/<username>/<timestamp>-permission-set-assign.json. One assignment runs at a time, and while it runs every insert, every assign button and the org picker are disabled. It generates no permission set (see Generate permission set… below), and permission set groups and profiles are not touched - Generate permission set… sits beside it and writes a permission set for the tree into your project, so you do not have to find the missing object and field access one insert failure at a time. It grants Create and Read on every object the tree inserts (an excluded object is left out) and field access to the tree's recipe fields: editable, or read-only for a formula, roll-up summary or auto number field. Required and master-detail fields are left out, because Salesforce does not take them in a permission set; so is a standard field unless its source file says
<required>false</required>(a retrieve leaves that out even for a field the org requires, such asContact.LastName), and so is a field whose source file (under thesalesforceObjectsPathoftreecipe.config.json) cannot be read; the notification counts each. The file isSDT_<tree folder>.permissionset-meta.xmlinmain/default/permissionsets/SDT_Treecipe/under the default package directory ofsfdx-project.json, its name made from the tree's folder name (Account-thru-OtherChildObject__c→SDT_Account_thru_OtherChildObject_c) and its label from the tree's name. Objects and fields are sorted, so writing it again for the same tree gives the same file. A confirmation names the file and says whether it will be overwritten; Treecipe owns this file, so a regeneration replaces any edit. It deploys nothing and needs no org. The notification offers Open file, Copy deploy command (sf project deploy start --metadata PermissionSet:<name>on the clipboard, never run) and Assign permission sets to me…, which offers the new permission set once you have deployed it. It is disabled while permission sets are assigned, and on a tree whose every object is excluded - The cockpit deploys no metadata. There is no "Deploy this metadata…" button: deploy the tree's objects and fields, and its permission sets, with your usual deploy (for example
sf project deploy start). + New scratch org deploys nothing either: it creates and selects the org, and its notification can copy the deploy command for you - To regenerate a recipe, run Generate Treecipe from the Command Palette. It reads the object metadata in your workspace, not the org, so retrieve the org's changes first (for example
sf project retrieve start) for them to reach the recipe. Then choose the new run in the cockpit's run selector - Every tab has its own search box. It filters only that tab of that card, keeps its text when you switch tabs or collapse the card, and starts empty when a new run is drawn. It matches only what the tab draws:
- Treecipe: object and field names, labels, the type with its size, controlling fields and faker expressions. Typing an object's name shows all of its fields
- Previously Used Data Sets: the data set folder name
- Query: each query's object, kind, notes and text
- A search never hides an object. One with nothing matching stays listed, collapsed and marked no matching fields, so a search never looks like missing data. Previously Used Data Sets hides the rows that do not match and says how many are left
- Switch runs from the selector in the toolbar. Each run is labelled with when it was generated (UTC) and which faker backend wrote it
- Click an object name, or a field's
↗ yml, to open the recipe.ymlat that exact line. Each field row also shows its faker expression - Fields that only the recipe file carries are shown too. Standard-field mappings such as
Account.Name, and the record type line, are written straight into the recipe and are not in the wrapper file. They appear marked read from the recipe file - There is no Compare tab. The cockpit no longer compares a tree's metadata with an org field by field. To see what an org lacks, choose it in the Treecipe tab: the insert's own check says which objects the org does not have; deploy them with your usual deploy. A recipe field the org lacks shows up in the insert's notification and its View errors
Which orgs the pickers list
Every org picker (the Recipe Cockpit's Choose org… in the Treecipe tab, Insert Data Set by Directory and Run Picklist Dependency Check) lists only the authorized orgs that answer when checked. The extension checks them itself, through @salesforce/core, and runs no sf org list:
- The authorized orgs are the ones the Salesforce CLI has stored (
sf org login web, a scratch org you created), read from the CLI's own files with their aliases. - Each one is pinged once, with the same request
sf org listpings with. An org that answers is listed. If its access token had expired, the ping renews it and saves it where the CLI reads it, as any connection does. - A scratch org past its expiration date is left out without a request. An org whose refresh token was revoked, a deleted scratch org, and an org that cannot be reached or does not answer within 20 seconds are left out. When nothing is left, the warning says how many were left out and why, and how to re-authorize one (
sf org login web). - Up to five orgs are checked at a time, and the whole check stops after a minute: an org still unanswered then is left out, never the whole list. The first picker you open in a VS Code session can take a few seconds and shows Checking org connections…. The answer is kept for the session, so later pickers open at once. The Treecipe tab's ⟳ Refresh orgs checks again.
- If the authorized orgs cannot be read at all, no org is listed and the message says why. The extension never falls back to listing every authorization unchecked.
- The Recipe Cockpit's org picker also leaves out every org not known to be a sandbox or a scratch org. When it leaves any org out, its note says so without counting them:
The Treecipe tab lists only sandboxes and scratch orgs that answer when checked, plus the CLI's default org, and inserts only into a sandbox or scratch org. - Treecipe connects only to the org you select. It never logs out of, deletes or changes an org to clean up the list.
VIDEO WALKTHROUGHS
Initiate Treecipe Configuration with expected Objects directory
https://github.com/user-attachments/assets/f8401f28-a04c-4abc-a56f-c860cce96dee
Generate Treecipe based on treecipe.config.jcon (keep an eye out for OOTB fields and "REMOVE ME" lines)
https://github.com/user-attachments/assets/fd127b55-d434-4a73-9d65-cf4172fbce6f
Run Snowfakery by existing recipe yaml file
https://github.com/user-attachments/assets/d7dfcf70-70f8-4ce3-b254-280e2bbb0b7d
Insert Data Set by Directory
https://github.com/user-attachments/assets/a0491f86-9360-4450-afae-f71fe07dbc21
Troubleshooting, Exception Handling, and Reporting Bugs
See below for troubleshooting when specific commands are not working:
Salesforce Treecipe - Generate Treecipe - generateRecipeFromConfigurationDetail:
- Ensure "Initiate Configuration File" was successfully run
- Ensure path in treecipe.config.json uses forward-slashes
- Ensure "defaultFakerService" is set to "snowfakery"
- "Expected treecipe and config file missing" while
treecipe/treecipe.config.jsonexists: thesalesforce-data-treecipe.treecipeConfigurationPathsetting names a file that is not there, usually because the project was moved or re-cloned, or.vscode/settings.jsoncame from another machine. When the workspace config exists, the extension now switches to it, updates the setting and says so. If the dialog names that setting, delete it from.vscode/settings.jsonor re-run "Initiate Configuration File". A value in User settings is ignored
Salesforce Treecipe: Initiate Configuration File - initiateTreecipeConfigurationSetup:
- Ensure expected project directory was selected
NOTE:
All commands are wrapped in try-catch and will prompt a "Report a Bug" dialog. This generates a GitHub Issue template with a stack trace.
Video Walkthrough:
https://github.com/user-attachments/assets/dff4a3cb-e244-4959-9dec-dcf094f713c2
Contributing
This project and codebase will be open-sourced shortly :)
License
This extension is licensed under the MIT License.
Install Snowfakery CLI
Snowfakery CLI Installation and Usage
Overview
Snowfakery is a tool for generating synthetic data. This document provides instructions for installing and using the Snowfakery CLI on any operating system.
Prerequisites
Python 3.8+ is required:
python --versionpip (Python package manager): https://pip.pypa.io/en/stable/installation/
Installation
pip install snowfakery
Verify the Installation
snowfakery --version
Usage (Without Salesforce Data Treecipe Extension)
snowfakery generate <path_to_your_snowfakery_recipe>
Official documentation: https://snowfakery.readthedocs.io/
Uninstalling Snowfakery
pip uninstall snowfakery