Systems and records
Salesforce export object metadata for a data dictionary
By SourceX Editorial · Updated
Short answer
To export Salesforce object metadata for a data dictionary, pull field definitions with a describe call (sf sobject describe prints the full JSON per object) and retrieve the CustomObject metadata with the Salesforce CLI for descriptions, help text, picklist value sets and validation rules. Add record-type picklist availability, mark formula fields, and leave flows, profiles and email templates out of the dataset.
Key takeaways
- sf sobject describe prints each object's fields with type, length, help text, picklist values and formula definitions as JSON.
- A Metadata API retrieve adds field descriptions, value set definitions, record types, business processes and validation rules.
- Describe shows only fields the running user can view, so run it as a user who can see every delivered field.
- List inactive picklist values and record-type availability; old records still carry values nobody can select today.
- Ship field meaning, not org machinery: leave flows, profiles, permission sets, email templates and custom settings out.
What does exporting Salesforce object metadata mean for a data dictionary?#
It means exporting the definitions behind the records, not the records themselves: which objects exist, what each field is called, its type and size, the values a picklist allows, the help text users saw, and the rules that blocked bad entries. A CRM dataset without that layer forces every buyer to guess what Status = Escalated or a custom field like Tier__c meant.
Salesforce exposes this layer through three official routes that overlap but are not identical. Describe calls return how the org presents each object and field to the API user right now. The Metadata API returns the configuration as XML files, including descriptions and validation rules that describe output does not carry. The Tooling API lets you query metadata as rows, for example one row per field through FieldDefinition.
The data dictionary that ships with the dataset is built from those exports, then trimmed to the fields actually in the delivery. Configuration that only runs the org, such as automation and security settings, stays behind.
Which Salesforce metadata export route returns which details?#
Use describe for the field list and live picklist values, the Metadata API for the descriptive and rule metadata, and the UI API when picklists differ by record type. Schema Builder is for looking, not exporting.
| Route | What it returns | Output | Use it for |
|---|---|---|---|
| sf sobject list and sf sobject describe (Salesforce CLI) | Object names by category (all, custom, standard); one DescribeSObjectResult per object with every visible field | JSON | The field inventory: API name, label, type, length, precision, scale, nillable, help text, picklist values, references |
| describeSObjects() SOAP call or REST describe | The same DescribeSObjectResult structure; the SOAP call returns at most 100 objects per call | XML or JSON | Scripted pulls when you already have an API client |
| Metadata API retrieve via sf project generate manifest and sf project retrieve start | CustomObject files with child fields, validation rules, record types and business processes; separate GlobalValueSet and StandardValueSet files | XML in source or metadata format (ZIP) | Field descriptions, help text, value set definitions, validation rule formulas and messages |
| Tooling API queries via sf data query --use-tooling-api | Row-based metadata such as FieldDefinition and EntityDefinition | CSV or JSON | A flat field list you can diff between exports |
| UI API picklist values by record type | Values for every picklist on one record type in one request; suited to dependent picklists | JSON | Picklists whose allowed values differ by record type |
| Schema Builder in Setup | A drag-and-drop canvas of objects, fields and lookup or master-detail relationships | On-screen diagram | Checking relationships before you write join notes; not a file export |
- 01Your work records
- 02Personal details removed
- 03You approve the release
- 04Licensed to AI developers
What should the metadata export map keep and leave out?#
Keep the metadata a reader needs to interpret a value in the dataset; leave out the metadata that only operates or secures the org. The map below is the working asset: each need, the route that answers it, the output, and the default keep or exclude call for a licensed CRM dataset.
| Need | Export route | Output | Keep or exclude |
|---|---|---|---|
| Object list and labels | sf sobject list --sobject all, then describe each object in scope | JSON | Keep, limited to objects in the delivery |
| Field list, types, lengths, required flags, references | sf sobject describe per object | JSON | Keep, limited to delivered fields |
| Field descriptions and help text | Metadata API retrieve of CustomObject (fields folder); describe also returns inlineHelpText | XML | Keep after review; rewrite text that names people or customers |
| Picklist values, including inactive ones | Describe picklistValues plus the field valueSet or GlobalValueSet and StandardValueSet files | JSON and XML | Keep every value that appears in the data, flagged active or inactive |
| Dependent picklists | Describe dependentPicklist, controllerName and each entry's validFor mapping; or UI API by record type | JSON | Keep as a controlling-to-dependent value table |
| Record types and process-driven values | Describe recordTypeInfos; RecordType and BusinessProcess files; UI API picklists by record type | JSON and XML | Keep record type names and the values each one allowed |
| Formula and roll-up definitions | Describe calculated and calculatedFormula; CustomField XML | JSON and XML | Keep the definition, and note the field is computed |
| Validation rules | Metadata API retrieve (validationRules folder) | XML | Keep as plain-language constraints; quote formulas only when they explain a value |
| Flows, workflow, profiles, permission sets | Metadata API Flow, Profile and PermissionSet types | XML | Exclude by default; summarize any automation that sets a delivered field |
| Email templates, custom settings, custom labels | Metadata API EmailTemplate and related types | XML | Exclude; these are content or org configuration, not field meaning |
How do you export field definitions with describe and the Salesforce CLI?#
List the objects, then describe each one in scope and save the JSON. With the Salesforce CLI that is sf sobject list --sobject all to see names, then sf sobject describe --sobject Account --json, repeated for Contact, Opportunity, Case and each custom object in the delivery. Add --use-tooling-api only when you are describing Tooling API objects.
Each field in the output carries the properties a dictionary needs: name, label, type, length, precision, scale, nillable, custom, unique, externalId, calculated and calculatedFormula, referenceTo and relationshipName for lookups, inlineHelpText, restrictedPicklist, and picklistValues. The object level carries recordTypeInfos with each record type's name and ID.
Two describe behaviors decide whether your dictionary is complete. First, the fields array contains only the fields the running user can view, so run the export as a user whose field-level security covers every delivered field and record that user's profile in the manifest. Second, inlineHelpText appears only when at least one field on the object has help text; a missing property means no help text on that object, not a failed export.
If you prefer rows to JSON, the Tooling API exposes FieldDefinition, which gives row-based access to field metadata. sf data query --use-tooling-api with --result-format csv and --output-file writes the result straight to a file you can diff between export runs.
How do you retrieve descriptions, picklist value sets and validation rules with the Metadata API?#
Build a manifest that names the objects and value sets, then retrieve it. sf project generate manifest --from-org <alias> --metadata CustomObject GlobalValueSet StandardValueSet writes a package.xml from what exists in the org; by default it leaves out metadata in managed and unlocked packages, so add --include-packages managed unlocked if a delivered field belongs to an installed package.
Name standard objects explicitly. Salesforce's migration guide says standard objects, and custom fields on them, must be named in package.xml under the CustomObject type to be retrieved, so list Account, Contact, Opportunity and Case by name rather than relying on a wildcard.
Run sf project retrieve start --manifest package.xml from inside a Salesforce DX project. Source format splits each object into folders: objects/Account/fields/Tier__c.field-meta.xml, plus validationRules, recordTypes and businessProcesses folders. Add --target-metadata-dir if you want the original metadata format as a ZIP instead. Each field file holds the label, type, description, inlineHelpText and, for picklists, the valueSet with its values.
Validation rules come back as their own files. Each one holds the formula that returns true when data is invalid and the error message users saw. Those two facts explain gaps and odd defaults in the records: if a rule required Close Reason once Status was Closed, a blank Close Reason on a closed case points to a record created before the rule or by an integration that bypassed it.
How should picklist values, dependencies and record types appear in the dictionary?#
List every value that occurs in the delivered records, not just the values active today, and say for each one whether it is active, which record types allowed it and which controlling value it depends on. That is the part of a CRM data dictionary most exports get wrong.
Inactive values matter because Salesforce keeps a deactivated value on the records that already hold it while hiding it from new selections. A Case export from 2019 to 2026 can therefore contain reasons nobody can pick any more. Pull the full value set from the field metadata, mark inactive values, and count how often each appears in the data.
Record types can narrow the values a user could choose. Salesforce's own developer blog notes that admins restrict picklist values per record type and that the describe-based Apex approach does not reflect that; the UI API resource returns the values for all picklists on one record type in a single request, including dependent hierarchies. Opportunity Stage, Case Status and Lead Status are a special case: their values come from the sales, support or lead process assigned to the record type, which is why the BusinessProcess files belong in the retrieve.
For dependent picklists, describe marks the field with dependentPicklist and names its controllerName, and each picklist entry carries a validFor mapping to the controlling values. Decode it once into a two-column table (controlling value, allowed dependent values) and ship that table instead of the encoded mapping. Standard picklists such as Industry or Lead Source live in StandardValueSet metadata from API version 38.0, and shared custom value sets live in GlobalValueSet files, so retrieve both.
What does a filled data dictionary row look like for Account, Case and Opportunity?#
One row per delivered field, combining describe output, the field XML and a plain-language note. The rows below are illustrative examples from a typical org; your labels, values and rules will differ, and a value list should come from your own export.
| Object.field (type) | Label and meaning | Allowed values and source | Interpretation notes |
|---|---|---|---|
| Account.Industry (picklist) | Industry: the account's primary industry as chosen by the account owner | StandardValueSet Industry; list every value present, active or inactive | Optional field; blanks mean not recorded, not unknown industry |
| Account.Tier__c (picklist, custom) | Customer tier: commercial segment used for routing (from field description) | Field valueSet; values restricted by record type per UI API export | Values renamed in 2024; old label kept as inactive value on older records |
| Case.Status (picklist) | Status: lifecycle stage of the support case | Support process assigned to each case record type | Closed values differ by support process; map each to open or closed |
| Case.Reason (picklist) | Case reason: agent-selected cause category | StandardValueSet CaseReason; dependent Sub_Reason__c controlled by Reason | Validation rule requires Reason when Status is Closed (illustrative) |
| Opportunity.StageName (picklist) | Stage: sales stage at export time | Sales process per opportunity record type | Pair with stage history if the delivery includes it; this field holds only the current stage |
| Opportunity.Amount (currency) | Amount: expected deal value in the record currency | Precision and scale from describe | Note whether multi-currency is on and which currency field accompanies it |
| Opportunity.Days_Open__c (formula, number) | Days open: computed age of the opportunity | calculatedFormula from describe, quoted in the dictionary | Not present in the weekly Data Export files; recompute or export through the API |
Which metadata should not ship with a CRM dataset?#
Leave out anything that describes how the org runs or who can see what, unless it changes the meaning of a delivered field. Profiles and permission sets map the security model; flows and workflow rules encode operating logic; custom settings can hold endpoints and configuration values; email templates are written content with merge fields. None of them help a buyer read a record, and several expose more about the company than the dataset should.
Where automation sets a delivered field, describe the effect in one line in the dictionary instead of shipping the flow. For example: Priority is set to High by automation when Account Tier is Enterprise. That keeps the interpretive fact and drops the implementation.
Review free text in metadata too. Field descriptions and help text sometimes name employees, customers or internal systems, and Salesforce notes that field-level help on objects exposed in an Experience Cloud site is visible to site members, so some of it may already be semi-public. Help text can run up to 510 characters, which is room for more than a label; read it before it ships.
How do you check the dictionary against the exported records?#
Reconcile the dictionary with the delivered files before release. Every column in the files should have a dictionary row, every dictionary row should point to a column, and every picklist value found in the data should appear in the value list.
- Field coverage: compare CSV headers with the describe field names for each object; flag fields the export user could not see.
- Formula and roll-up fields: Salesforce's Data Export FAQ says these are never included in Data Export files, so mark them as absent from that route or export them through the API.
- Picklist drift: count distinct values per picklist column and match them to active and inactive values from metadata; unknown values usually mean a renamed value or an integration writing free text.
- Record type coverage: confirm each delivered record type has its allowed-values list.
- Version stamp: record the org's API version used for describe, the export date and the manifest file name so the dictionary can be regenerated.
How does this apply when you license the CRM dataset?#
A buyer pays for records they can interpret, and the metadata export is what makes them interpretable. It also limits risk: the dictionary is built from definitions you reviewed, and automation and security configuration stay inside the company.
SourceX runs sourcing, rights review, contracting, data preparation, delivery and payment for businesses licensing operational data to AI developers, and the company approves exactly what is released before anything is shared. The exports on this page run in your own org with Salesforce's standard tools. The first step is a short company assessment, and no data uploads are needed to see if a company qualifies.
Exporting metadata does not settle whether you may license the records. The four permissions are separate questions: access to the org, privacy permission for the people in it, ownership of the records, and contract rights to license them. De-identification alone does not create a right to license.
Frequently asked questions
Can you export a list of all fields in Salesforce?
Yes. sf sobject describe --sobject <Object> --json returns every field the running user can view, with type, length, help text and picklist values; repeat it per object. For a flat file, query FieldDefinition through the Tooling API with sf data query --use-tooling-api and --result-format csv.
Does Schema Builder export metadata?
Schema Builder is a drag-and-drop canvas for viewing and editing objects, fields and relationships. Use it to check relationships, and use describe or a Metadata API retrieve when you need a file for a data dictionary.
How do you export picklist values from Salesforce, including inactive ones?
Describe returns picklistValues for each picklist field, and a Metadata API retrieve returns the field valueSet or the GlobalValueSet and StandardValueSet definitions. Inactive values stay on records that already hold them, so include them in the dictionary. Use the UI API picklist-values resource when allowed values differ by record type. Check that the values you expect appear in the describe output for each picklist.
Why are some fields missing from my describe output?
Describe returns only fields the running user can view under field-level security. Run the export as a user with access to every delivered field, and record that user in the export manifest.
Are formula fields included in the Salesforce weekly export?
No. Salesforce's Data Export FAQ says formula and roll-up summary fields are never included in export files. Document their formulas from describe or the field XML and export the computed values through the API if the dataset needs them.
Should validation rules go into a data dictionary?
Include them as plain-language constraints when they explain a value, such as a field that is required once a case closes. Retrieve them with the Metadata API, where each rule holds the error condition formula and the message users saw.
Sources
- The Salesforce CLI commands sf sobject list and sf sobject describe list objects by category and output each object's DescribeSObjectResult as JSON, including field and record type properties. Source
- sf project generate manifest can build package.xml from an org (excluding managed and unlocked package metadata by default unless --include-packages is used), and sf project retrieve start retrieves it in source format or as a metadata-format ZIP. Source
- In source format, a CustomObject decomposes into child folders for fields, validation rules, record types and business processes; GlobalValueSet and StandardValueSet are separate metadata types, and field files carry description, help text, type and value set. Source
- sf data query can run Tooling API queries and write CSV output to a file. Source
- Describe returns inlineHelpText only when at least one field on the object has help text, populates calculatedFormula for formula fields, and stores dependent picklist mappings in each entry's validFor with controllerName naming the controlling field. Source
- describeSObjects() returns at most 100 objects per call, and the fields array contains only fields the user can view. Source
- The Tooling API FieldDefinition object provides row-based access to field metadata. Source
- The UI API returns values for all picklist fields of a record type in one request, which suits dependent picklists. Source
- Admins can restrict picklist values per record type, which describe-based Apex does not reflect; the UI API picklist resources do. Source
- A validation rule contains a formula that returns true when data is invalid and an error message shown to the user. Source
- Standard objects, and custom fields on standard objects, must be named explicitly in package.xml under the CustomObject type to be retrieved. Source
- From API version 38.0, standard picklist fields are represented by the StandardValueSet metadata type. Source
- Schema Builder is a drag-and-drop tool for viewing the existing schema and adding objects, fields and relationships. Source
- Field-level help text allows up to 510 characters and is visible to Experience Cloud site members when the object is exposed in a site. Source
- Deactivating a picklist value hides it from selection while keeping it on records that already have it. Source
- Formula and roll-up summary fields are never included in Salesforce Data Export files. Source
- Opportunity Stage, Case Status and Lead Status values are set through sales, support and lead processes assigned to record types rather than record type picklist settings. Source
Related resources
See if your company qualifies
A short company assessment. No data uploads are needed.