data Commands
force:data:bulk:delete
Help for force:data:bulk:delete
The file must be a CSV file with only one column: "Id".
One job can contain many batches, depending on the length of the CSV file.
Returns a job ID and a batch ID. Use these IDs to check job status with data:bulk:status.
Examples for force:data:bulk:delete
sfdx force:data:bulk:delete -s Account -f ./path/to/file.csv
sfdx force:data:bulk:delete -s MyObject__c -f ./path/to/file.csv
Command Syntax
- sfdx force:data:bulk:delete
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -f CSVFILE
- -s SOBJECTTYPE
- [-w WAIT]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -f | --csvfile CSVFILE
- Required
-
The path to the CSV file containing the ids of the records to delete.
- Type: filepath
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The sObject type of the records you’re deleting.
- Type: string
- -w | --wait WAIT
- Optional
-
The number of minutes to wait for the command to complete before displaying the results.
- Type: minutes
force:data:bulk:status
Help for force:data:bulk:status
Run this command using the job ID or batch ID returned from the force:data:bulk:delete or force:data:bulk:upsert commands.
Examples for force:data:bulk:status
sfdx force:data:bulk:status -i 750xx000000005sAAA
sfdx force:data:bulk:status -i 750xx000000005sAAA -b 751xx000000005nAAA
Command Syntax
- sfdx force:data:bulk:status
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- [-b BATCHID]
- -i JOBID
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -b | --batchid BATCHID
- Optional
-
The ID of the batch whose status you want to view.
- Type: string
- -i | --jobid JOBID
- Required
-
The ID of the job you want to view or of the job whose batch you want to view.
- Type: string
force:data:bulk:upsert
Help for force:data:bulk:upsert
Inserts or updates records from a CSV file.
One job can contain many batches, depending on the length of the CSV file.
Returns a job ID and a batch ID. Use these IDs to check job status with data:bulk:status.
For information about formatting your CSV file, see "Prepare CSV Files" in the Bulk API Developer Guide.
By default, the job runs the batches in parallel. Specify --serial to run them serially.
Examples for force:data:bulk:upsert
sfdx force:data:bulk:upsert -s MyObject__c -f ./path/to/file.csv -i MyField__c
sfdx force:data:bulk:upsert -s MyObject__c -f ./path/to/file.csv -i Id -w 2
Command Syntax
- sfdx force:data:bulk:upsert
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -i EXTERNALID
- -f CSVFILE
- -s SOBJECTTYPE
- [-w WAIT]
- [-r]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -i | --externalid EXTERNALID
- Required
-
The column name of the external ID.
- Type: string
- -f | --csvfile CSVFILE
- Required
-
The path to the CSV file that defines the records to upsert.
- Type: filepath
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The sObject type of the records you want to upsert.
- Type: string
- -w | --wait WAIT
- Optional
-
The number of minutes to wait for the command to complete before displaying the results.
- Type: minutes
- -r | --serial
- Optional
-
Run batches in serial mode.
- Type: boolean
force:data:record:create
Help for force:data:record:create
The format of a field-value pair is <fieldName>=<value>.
Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
Enclose values that contain spaces in single quotes.
To get data on API performance metrics, specify both --perflog and --json.
Examples for force:data:record:create
sfdx force:data:record:create -s Account -v "Name=Acme"
sfdx force:data:record:create -s Account -v "Name='Universal Containers'"
sfdx force:data:record:create -s Account -v "Name='Universal Containers' Website=www.example.com"
sfdx force:data:record:create -t -s TraceFlag -v "DebugLevelId=7dl170000008U36AAE StartDate=2017-12-01T00:26:04.000+0000 ExpirationDate=2017-12-01T00:56:04.000+0000 LogType=CLASS_TRACING TracedEntityId=01p17000000R6bLAAS"
sfdx force:data:record:create -s Account -v "Name=Acme" --perflog --json
Command Syntax
- sfdx force:data:record:create
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -s SOBJECTTYPE
- -v VALUES
- [-t]
- [--perflog]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The type of the record you’re creating.
- Type: string
- -v | --values VALUES
- Required
-
The <fieldName>=<value> pairs you’re creating.
- Type: string
- -t | --usetoolingapi
- Optional
-
Create the record with tooling api.
- Type: boolean
- --perflog
- Optional
-
Get API performance data.
- Type: boolean
force:data:record:delete
Help for force:data:record:delete
Specify an sObject type and either an ID or a list of <fieldName>=<value> pairs.
The format of a field-value pair is <fieldName>=<value>.
Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
Enclose values that contain spaces in single quotes.
To get data on API performance metrics, specify both --perflog and --json.
Examples for force:data:record:delete
sfdx force:data:record:delete -s Account -i 001D000000Kv3dl
sfdx force:data:record:delete -s Account -w "Name=Acme"
sfdx force:data:record:delete -s Account -w "Name='Universal Containers'"
sfdx force:data:record:delete -s Account -w "Name='Universal Containers' Phone='(123) 456-7890'"
sfdx force:data:record:delete -t -s TraceFlag -i 7tf170000009cU6AAI --perflog --json
Command Syntax
- sfdx force:data:record:delete
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -s SOBJECTTYPE
- [-i SOBJECTID]
- [-w WHERE]
- [-t]
- [--perflog]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The type of the record you’re deleting.
- Type: string
- -i | --sobjectid SOBJECTID
- Optional
-
The ID of the record you’re deleting.
- Type: id
- -w | --where WHERE
- Optional
-
A list of <fieldName>=<value> pairs to search for.
- Type: string
- -t | --usetoolingapi
- Optional
-
Delete the record with Tooling API.
- Type: boolean
- --perflog
- Optional
-
Get API performance data.
- Type: boolean
force:data:record:get
Help for force:data:record:get
Specify an sObject type and either an ID or a list of <fieldName>=<value> pairs.
The format of a field-value pair is <fieldName>=<value>.
Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
Enclose values that contain spaces in single quotes.
To get data on API performance metrics, specify both --perflog and --json.
Examples for force:data:record:get
sfdx force:data:record:get -s Account -i 001D000000Kv3dl
sfdx force:data:record:get -s Account -w "Name=Acme"
sfdx force:data:record:get -s Account -w "Name='Universal Containers'"
sfdx force:data:record:get -s Account -w "Name='Universal Containers' Phone='(123) 456-7890'"
sfdx force:data:record:get -t -s TraceFlag -i 7tf170000009cUBAAY --perflog --json
Command Syntax
- sfdx force:data:record:get
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -s SOBJECTTYPE
- [-i SOBJECTID]
- [-w WHERE]
- [-t]
- [--perflog]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The type of the record you’re retrieving.
- Type: string
- -i | --sobjectid SOBJECTID
- Optional
-
The ID of the record you’re retrieving.
- Type: id
- -w | --where WHERE
- Optional
-
A list of <fieldName>=<value> pairs to search for.
- Type: string
- -t | --usetoolingapi
- Optional
-
Retrieve the record with Tooling API.
- Type: boolean
- --perflog
- Optional
-
Get API performance data.
- Type: boolean
force:data:record:update
Help for force:data:record:update
The format of a field-value pair is <fieldName>=<value>.
Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
Enclose values that contain spaces in single quotes.
To get data on API performance metrics, specify both --perflog and --json.
Examples for force:data:record:update
sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name=NewAcme"
sfdx force:data:record:update -s Account -w "Name='Old Acme'" -v "Name='New Acme'"
sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name='Acme III' Website=www.example.com"
sfdx force:data:record:update -t -s TraceFlag -i 7tf170000009cUBAAY -v "ExpirationDate=2017-12-01T00:58:04.000+0000"
sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name=NewAcme" --perflog --json
Command Syntax
- sfdx force:data:record:update
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -s SOBJECTTYPE
- [-i SOBJECTID]
- [-w WHERE]
- -v VALUES
- [-t]
- [--perflog]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -s | --sobjecttype SOBJECTTYPE
- Required
-
The sObject type of the record you’re updating.
- Type: string
- -i | --sobjectid SOBJECTID
- Optional
-
The ID of the record you’re updating.
- Type: id
- -w | --where WHERE
- Optional
-
A list of <fieldName>=<value> pairs to search for.
- Type: string
- -v | --values VALUES
- Required
-
The <fieldName>=<value> pairs you’re updating.
- Type: string
- -t | --usetoolingapi
- Optional
-
Update the record with Tooling API.
- Type: boolean
- --perflog
- Optional
-
Get API performance data.
- Type: boolean
force:data:soql:query
Help for force:data:soql:query
When you execute this command in a project, it executes the query against the data in your default scratch org.
To get data on API performance metrics, specify both --perflog and --json.
Examples for force:data:soql:query
sfdx force:data:soql:query -q "SELECT Id, Name, Account.Name FROM Contact"
sfdx force:data:soql:query -q "SELECT Id, Name FROM Account WHERE ShippingState IN ('CA', 'NY')"
sfdx force:data:soql:query -q "SELECT Id, Name FROM Account WHERE ShippingState IN ('CA', 'NY')" --perflog --json
sfdx force:data:soql:query -q "SELECT Name FROM ApexTrigger" -t
Command Syntax
- sfdx force:data:soql:query
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -q QUERY
- [-t]
- [-r RESULTFORMAT]
- [--perflog]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -q | --query QUERY
- Required
-
SOQL query to execute.
- Type: string
- -t | --usetoolingapi
- Optional
-
Execute query with Tooling API.
- Type: boolean
- -r | --resultformat RESULTFORMAT
- Optional
-
Result format emitted to stdout; --json flag overrides this parameter.
- Type: enum
- Permissible values are: human, csv, json
- Default value: human
- --perflog
- Optional
-
Get API performance data.
- Type: boolean
force:data:tree:export
Help for force:data:tree:export
Exports data from an org into sObject tree format for use with the force:data:tree:import command.
The query for export can return a maximum of 2,000 records. For more information, see the REST API Developer Guide: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
Examples for force:data:tree:export
sfdx force:data:tree:export -q "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM Broker__c"
sfdx force:data:tree:export -q <path to file containing soql query> -x export-demo -d /tmp/sfdx-out -p
Command Syntax
- sfdx force:data:tree:export
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- -q QUERY
- [-p]
- [-x PREFIX]
- [-d OUTPUTDIR]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -q | --query QUERY
- Required
-
Soql query, or filepath of file containing a soql query, to retrieve records.
- Type: string
- -p | --plan
- Optional
-
Generate mulitple sobject tree files and a plan definition file for aggregated import.
- Type: boolean
- -x | --prefix PREFIX
- Optional
-
Prefix of generated files.
- Type: string
- -d | --outputdir OUTPUTDIR
- Optional
-
Directory to store files'.
- Type: directory
force:data:tree:import
Help for force:data:tree:import
Imports data into an org using the SObject Tree Save API. This data can include master-detail relationships.
To generate JSON files for use with force:data:tree:import, run "sfdx force:data:tree:export".
The SObject Tree API supports requests that contain up to 200 records. For more information, see the REST API Developer Guide: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
Examples for force:data:tree:import
sfdx force:data:tree:import -f Contact.json,Account.json -u me@my.org
sfdx force:data:tree:import -p Account-Contact-plan.json -u me@my.org
Command Syntax
- sfdx force:data:tree:import
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- [-f SOBJECTTREEFILES]
- [-p PLAN]
- [--confighelp]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -u | --targetusername TARGETUSERNAME
- Optional
-
A username or alias for the target org. Overrides the default target org.
- Type: string
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- -f | --sobjecttreefiles SOBJECTTREEFILES
- Optional
-
Comma-delimited, ordered paths of json files containing collection of record trees to insert.
- Type: array
- -p | --plan PLAN
- Optional
-
Path to plan to insert multiple data files that have master-detail relationships.
- Type: filepath
- --confighelp
- Optional
-
Display schema information for the --plan configuration file to stdout; if you use this option, all other options except --json are ignored.
- Type: boolean