@salesforce/plugin-data 2.1.21 → 2.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +947 -320
  2. package/lib/api/data/tree/exportApi.js +66 -73
  3. package/lib/api/data/tree/exportApi.js.map +1 -1
  4. package/lib/api/data/tree/importApi.js +62 -62
  5. package/lib/api/data/tree/importApi.js.map +1 -1
  6. package/lib/batcher.js +80 -101
  7. package/lib/batcher.js.map +1 -1
  8. package/lib/commands/data/create/record.js +64 -0
  9. package/lib/commands/data/create/record.js.map +1 -0
  10. package/lib/commands/data/delete/bulk.js +78 -0
  11. package/lib/commands/data/delete/bulk.js.map +1 -0
  12. package/lib/commands/data/delete/record.js +83 -0
  13. package/lib/commands/data/delete/record.js.map +1 -0
  14. package/lib/commands/data/export/tree.js +57 -0
  15. package/lib/commands/data/export/tree.js.map +1 -0
  16. package/lib/commands/data/get/record.js +73 -0
  17. package/lib/commands/data/get/record.js.map +1 -0
  18. package/lib/commands/data/import/tree.js +85 -0
  19. package/lib/commands/data/import/tree.js.map +1 -0
  20. package/lib/commands/data/query/resume.js +55 -0
  21. package/lib/commands/data/query/resume.js.map +1 -0
  22. package/lib/commands/data/query.js +283 -0
  23. package/lib/commands/data/query.js.map +1 -0
  24. package/lib/commands/data/resume.js +64 -0
  25. package/lib/commands/data/resume.js.map +1 -0
  26. package/lib/commands/data/update/record.js +101 -0
  27. package/lib/commands/data/update/record.js.map +1 -0
  28. package/lib/commands/data/upsert/bulk.js +88 -0
  29. package/lib/commands/data/upsert/bulk.js.map +1 -0
  30. package/lib/dataCommand.js +103 -202
  31. package/lib/dataCommand.js.map +1 -1
  32. package/lib/dataSoqlQueryTypes.js +2 -6
  33. package/lib/dataSoqlQueryTypes.js.map +1 -1
  34. package/lib/flags.js +27 -0
  35. package/lib/flags.js.map +1 -0
  36. package/lib/reporters.js +58 -66
  37. package/lib/reporters.js.map +1 -1
  38. package/messages/batcher.md +39 -0
  39. package/messages/bulk.delete.md +31 -0
  40. package/messages/bulk.report.md +17 -0
  41. package/messages/bulk.status.md +29 -0
  42. package/messages/bulk.upsert.md +43 -0
  43. package/messages/exportApi.md +25 -0
  44. package/messages/importApi.md +52 -0
  45. package/messages/messages.md +20 -0
  46. package/messages/record.create.md +45 -0
  47. package/messages/record.delete.md +53 -0
  48. package/messages/record.get.md +47 -0
  49. package/messages/record.update.md +61 -0
  50. package/messages/soql.query.md +72 -0
  51. package/messages/tree.export.md +41 -0
  52. package/messages/tree.import.md +37 -0
  53. package/oclif.manifest.json +1 -1
  54. package/package.json +50 -51
  55. package/lib/api/data/tree/exportApi.d.ts +0 -77
  56. package/lib/api/data/tree/importApi.d.ts +0 -60
  57. package/lib/batcher.d.ts +0 -79
  58. package/lib/commands/force/data/bulk/delete.d.ts +0 -11
  59. package/lib/commands/force/data/bulk/delete.js +0 -58
  60. package/lib/commands/force/data/bulk/delete.js.map +0 -1
  61. package/lib/commands/force/data/bulk/status.d.ts +0 -11
  62. package/lib/commands/force/data/bulk/status.js +0 -61
  63. package/lib/commands/force/data/bulk/status.js.map +0 -1
  64. package/lib/commands/force/data/bulk/upsert.d.ts +0 -11
  65. package/lib/commands/force/data/bulk/upsert.js +0 -76
  66. package/lib/commands/force/data/bulk/upsert.js.map +0 -1
  67. package/lib/commands/force/data/record/create.d.ts +0 -10
  68. package/lib/commands/force/data/record/create.js +0 -58
  69. package/lib/commands/force/data/record/create.js.map +0 -1
  70. package/lib/commands/force/data/record/delete.d.ts +0 -10
  71. package/lib/commands/force/data/record/delete.js +0 -72
  72. package/lib/commands/force/data/record/delete.js.map +0 -1
  73. package/lib/commands/force/data/record/get.d.ts +0 -10
  74. package/lib/commands/force/data/record/get.js +0 -65
  75. package/lib/commands/force/data/record/get.js.map +0 -1
  76. package/lib/commands/force/data/record/update.d.ts +0 -10
  77. package/lib/commands/force/data/record/update.js +0 -90
  78. package/lib/commands/force/data/record/update.js.map +0 -1
  79. package/lib/commands/force/data/soql/bulk/report.d.ts +0 -9
  80. package/lib/commands/force/data/soql/bulk/report.js +0 -45
  81. package/lib/commands/force/data/soql/bulk/report.js.map +0 -1
  82. package/lib/commands/force/data/soql/query.d.ts +0 -64
  83. package/lib/commands/force/data/soql/query.js +0 -300
  84. package/lib/commands/force/data/soql/query.js.map +0 -1
  85. package/lib/commands/force/data/tree/export.d.ts +0 -10
  86. package/lib/commands/force/data/tree/export.js +0 -52
  87. package/lib/commands/force/data/tree/export.js.map +0 -1
  88. package/lib/commands/force/data/tree/import.d.ts +0 -19
  89. package/lib/commands/force/data/tree/import.js +0 -81
  90. package/lib/commands/force/data/tree/import.js.map +0 -1
  91. package/lib/dataCommand.d.ts +0 -57
  92. package/lib/dataSoqlQueryTypes.d.ts +0 -63
  93. package/lib/index.d.ts +0 -2
  94. package/lib/reporters.d.ts +0 -57
  95. package/messages/batcher.json +0 -12
  96. package/messages/bulk.delete.json +0 -12
  97. package/messages/bulk.report.json +0 -7
  98. package/messages/bulk.status.json +0 -12
  99. package/messages/bulk.upsert.json +0 -14
  100. package/messages/exportApi.json +0 -8
  101. package/messages/importApi.json +0 -16
  102. package/messages/messages.json +0 -11
  103. package/messages/record.create.json +0 -15
  104. package/messages/record.delete.json +0 -16
  105. package/messages/record.get.json +0 -14
  106. package/messages/record.update.json +0 -18
  107. package/messages/soql.query.json +0 -26
  108. package/messages/tree.export.json +0 -11
  109. package/messages/tree.import.json +0 -13
package/README.md CHANGED
@@ -76,529 +76,1156 @@ sfdx plugins
76
76
 
77
77
  <!-- commands -->
78
78
 
79
- - [`sfdx force:data:bulk:delete -f <filepath> -s <string> [-w <minutes>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatabulkdelete--f-filepath--s-string--w-minutes--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
80
- - [`sfdx force:data:bulk:status -i <string> [-b <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatabulkstatus--i-string--b-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
81
- - [`sfdx force:data:bulk:upsert -i <string> -f <filepath> -s <string> [-w <minutes>] [-r] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatabulkupsert--i-string--f-filepath--s-string--w-minutes--r--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
82
- - [`sfdx force:data:record:create -s <string> -v <string> [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatarecordcreate--s-string--v-string--t---perflog---json--u-string---apiversion-string---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
83
- - [`sfdx force:data:record:delete -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatarecorddelete--s-string--i-id---w-string--t---perflog---json--u-string---apiversion-string---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
84
- - [`sfdx force:data:record:get -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatarecordget--s-string--i-id---w-string--t---perflog---json--u-string---apiversion-string---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
85
- - [`sfdx force:data:record:update -s <string> -v <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatarecordupdate--s-string--v-string--i-id---w-string--t---perflog---json--u-string---apiversion-string---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
86
- - [`sfdx force:data:soql:bulk:report -i <string> [-r human|csv|json] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatasoqlbulkreport--i-string--r-humancsvjson--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
87
- - [`sfdx force:data:soql:query [-q <string> | -f <filepath>] [-w <minutes> [-b | -t]] [-r human|csv|json] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatasoqlquery--q-string---f-filepath--w-minutes--b---t--r-humancsvjson---perflog---json--u-string---apiversion-string---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
88
- - [`sfdx force:data:tree:export -q <string> [-p] [-x <string>] [-d <directory>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatatreeexport--q-string--p--x-string--d-directory--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
89
- - [`sfdx force:data:tree:import [-f <array> | -p <filepath>] [--confighelp] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-forcedatatreeimport--f-array---p-filepath---confighelp--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
79
+ - [`sfdx data:create:record`](#sfdx-datacreaterecord)
80
+ - [`sfdx data:delete:bulk`](#sfdx-datadeletebulk)
81
+ - [`sfdx data:delete:record`](#sfdx-datadeleterecord)
82
+ - [`sfdx data:export:tree`](#sfdx-dataexporttree)
83
+ - [`sfdx data:get:record`](#sfdx-datagetrecord)
84
+ - [`sfdx data:import:tree`](#sfdx-dataimporttree)
85
+ - [`sfdx data:query`](#sfdx-dataquery)
86
+ - [`sfdx data:query:resume`](#sfdx-dataqueryresume)
87
+ - [`sfdx data:resume`](#sfdx-dataresume)
88
+ - [`sfdx data:update:record`](#sfdx-dataupdaterecord)
89
+ - [`sfdx data:upsert:bulk`](#sfdx-dataupsertbulk)
90
+ - [`sfdx force:data:bulk:delete`](#sfdx-forcedatabulkdelete)
91
+ - [`sfdx force:data:bulk:status`](#sfdx-forcedatabulkstatus)
92
+ - [`sfdx force:data:bulk:upsert`](#sfdx-forcedatabulkupsert)
93
+ - [`sfdx force:data:record:create`](#sfdx-forcedatarecordcreate)
94
+ - [`sfdx force:data:record:delete`](#sfdx-forcedatarecorddelete)
95
+ - [`sfdx force:data:record:get`](#sfdx-forcedatarecordget)
96
+ - [`sfdx force:data:record:update`](#sfdx-forcedatarecordupdate)
97
+ - [`sfdx force:data:soql:bulk:report`](#sfdx-forcedatasoqlbulkreport)
98
+ - [`sfdx force:data:soql:query`](#sfdx-forcedatasoqlquery)
99
+ - [`sfdx force:data:tree:export`](#sfdx-forcedatatreeexport)
100
+ - [`sfdx force:data:tree:import`](#sfdx-forcedatatreeimport)
101
+
102
+ ## `sfdx data:create:record`
103
+
104
+ Create and insert a record into a Salesforce or Tooling API object.
90
105
 
91
- ## `sfdx force:data:bulk:delete -f <filepath> -s <string> [-w <minutes>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
106
+ ```
107
+ USAGE
108
+ $ sfdx data:create:record -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-t]
109
+
110
+ FLAGS
111
+ -o, --target-org=<value> (required) Username or alias of the target org.
112
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're inserting a record
113
+ into.
114
+ -t, --use-tooling-api Use Tooling API so you can insert a record in a Tooling API object.
115
+ -v, --values=<value> (required) Values for the flags in the form <fieldName>=<value>, separate multiple pairs
116
+ with spaces.
117
+ --api-version=<value> Override the api version used for api requests made by this command
118
+
119
+ GLOBAL FLAGS
120
+ --json Format output as json.
121
+
122
+ DESCRIPTION
123
+ Create and insert a record into a Salesforce or Tooling API object.
124
+
125
+ You must specify a value for all required fields of the object.
126
+
127
+ When specifying fields, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of double
128
+ quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
92
129
 
93
- bulk delete records from a csv file
130
+ This command inserts a record into Salesforce objects by default. Use the --use-tooling-api flag to insert into a
131
+ Tooling API object.
132
+
133
+ ALIASES
134
+ $ sfdx force:data:record:create
135
+
136
+ EXAMPLES
137
+ Insert a record into the Account object of your default org; only the required Name field has a value:
138
+
139
+ $ sfdx data:create:record --sobject Account --values "Name=Acme"
140
+
141
+ Insert an Account record with values for two fields, one value contains a space; the command uses the org with alias
142
+ "my-scratch":
143
+
144
+ $ sfdx data:create:record --sobject Account --values "Name='Universal Containers' Website=www.example.com" \
145
+ --target-org my-scratch
146
+
147
+ Insert a record into the Tooling API object TraceFlag:
148
+
149
+ $ sfdx data:create:record --use-tooling-api --sobject TraceFlag --values "DebugLevelId=7dl170000008U36AAE \
150
+ StartDate=2022-12-15T00:26:04.000+0000 ExpirationDate=2022-12-15T00:56:04.000+0000 LogType=CLASS_TRACING \
151
+ TracedEntityId=01p17000000R6bLAAS"
152
+ ```
153
+
154
+ _See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/create/record.ts)_
155
+
156
+ ## `sfdx data:delete:bulk`
157
+
158
+ Bulk delete records from an org using a CSV file.
94
159
 
95
160
  ```
96
161
  USAGE
97
- $ sfdx force:data:bulk:delete -f <filepath> -s <string> [-w <minutes>] [-u <string>] [--apiversion <string>] [--json]
98
- [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
162
+ $ sfdx data:delete:bulk -o <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
99
163
 
100
164
  FLAGS
101
- -f, --csvfile=<value> (required) the path to the CSV file
102
- containing the ids of the records to
103
- delete
104
- -s, --sobjecttype=<value> (required) the sObject type of the
105
- records you’re deleting
106
- -u, --targetusername=<value> username or alias for the target
107
- org; overrides default target org
108
- -w, --wait=<value> the number of minutes to wait for
109
- the command to complete before
110
- displaying the results
111
- --apiversion=<value> override the api version used for
112
- api requests made by this command
113
- --json format output as json
114
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
115
- this command invocation
165
+ -f, --file=<value> (required) CSV file that contains the IDs of the records to delete.
166
+ -o, --target-org=<value> (required) Username or alias of the target org.
167
+ -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
168
+ delete records from.
169
+ -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before displaying
170
+ the results.
171
+ --api-version=<value> Override the api version used for api requests made by this command
172
+
173
+ GLOBAL FLAGS
174
+ --json Format output as json.
116
175
 
117
176
  DESCRIPTION
118
- bulk delete records from a csv file
177
+ Bulk delete records from an org using a CSV file.
119
178
 
120
- The file must be a CSV file with only one column: "Id".
179
+ The CSV file must have only one column ("Id") and then the list of record IDs you want to delete, one ID per line.
121
180
 
122
- One job can contain many batches, depending on the length of the CSV file.
181
+ When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
182
+ returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
183
+ minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
184
+ the "sfdx data resume" command. A single job can contain many batches, depending on the length of the CSV file.
123
185
 
124
- Returns a job ID and a batch ID. Use these IDs to check job status with data:bulk:status.
186
+ ALIASES
187
+ $ sfdx force:data:bulk:delete
125
188
 
126
189
  EXAMPLES
127
- $ sfdx force:data:bulk:delete -s Account -f ./path/to/file.csv
190
+ Bulk delete Account records using the list of IDs in the "files/delete.csv" file:
191
+
192
+ $ sfdx data:delete:bulk --sobject Account --file files/delete.csv
128
193
 
129
- $ sfdx force:data:bulk:delete -s MyObject__c -f ./path/to/file.csv
194
+ Bulk delete records from a custom object and wait 5 minutes for the command to complete:
195
+
196
+ $ sfdx data:delete:bulk --sobject MyObject__c --file files/delete.csv --wait 5
130
197
  ```
131
198
 
132
- _See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/bulk/delete.ts)_
199
+ _See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/delete/bulk.ts)_
133
200
 
134
- ## `sfdx force:data:bulk:status -i <string> [-b <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
201
+ ## `sfdx data:delete:record`
135
202
 
136
- view the status of a bulk data load job or batch
203
+ Deletes a single record from a Salesforce or Tooling API object.
137
204
 
138
205
  ```
139
206
  USAGE
140
- $ sfdx force:data:bulk:status -i <string> [-b <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel
141
- trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
207
+ $ sfdx data:delete:record -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
142
208
 
143
209
  FLAGS
144
- -b, --batchid=<value> the ID of the batch whose status you
145
- want to view
146
- -i, --jobid=<value> (required) the ID of the job you
147
- want to view or of the job whose
148
- batch you want to view
149
- -u, --targetusername=<value> username or alias for the target
150
- org; overrides default target org
151
- --apiversion=<value> override the api version used for
152
- api requests made by this command
153
- --json format output as json
154
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
155
- this command invocation
210
+ -i, --record-id=<value> ID of the record you’re deleting.
211
+ -o, --target-org=<value> (required) Username or alias of the target org.
212
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're deleting a record
213
+ from.
214
+ -t, --use-tooling-api Use Tooling API so you can delete a record from a Tooling API object.
215
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to delete.
216
+ --api-version=<value> Override the api version used for api requests made by this command
217
+
218
+ GLOBAL FLAGS
219
+ --json Format output as json.
156
220
 
157
221
  DESCRIPTION
158
- view the status of a bulk data load job or batch
222
+ Deletes a single record from a Salesforce or Tooling API object.
159
223
 
160
- Run this command using the job ID or batch ID returned from the force:data:bulk:delete or force:data:bulk:upsert
161
- commands.
224
+ Specify the record you want to delete with either its ID or with a list of field-value pairs that identify the record.
225
+ If your list of fields identifies more than one record, the delete fails; the error displays how many records were
226
+ found.
227
+
228
+ When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
229
+ double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
230
+
231
+ This command deletes a record from Salesforce objects by default. Use the --use-tooling-api flag to delete from a
232
+ Tooling API object.
233
+
234
+ ALIASES
235
+ $ sfdx force:data:record:delete
162
236
 
163
237
  EXAMPLES
164
- $ sfdx force:data:bulk:status -i 750xx000000005sAAA
238
+ Delete a record from Account with the specified (truncated) ID:
239
+
240
+ $ sfdx data:delete:record --sobject Account --record-id 00180XX
241
+
242
+ Delete a record from Account whose name equals "Acme":
243
+
244
+ $ sfdx data:delete:record --sobject Account --where "Name=Acme"
245
+
246
+ Delete a record from Account identified with two field values, one that contains a space; the command uses the org
247
+ with alias "my-scratch":
248
+
249
+ $ sfdx data:delete:record --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" \
250
+ --target-org myscratch
251
+
252
+ Delete a record from the Tooling API object TraceFlag with the specified (truncated) ID:
165
253
 
166
- $ sfdx force:data:bulk:status -i 750xx000000005sAAA -b 751xx000000005nAAA
254
+ $ sfdx data:delete:record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
167
255
  ```
168
256
 
169
- _See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/bulk/status.ts)_
257
+ _See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/delete/record.ts)_
170
258
 
171
- ## `sfdx force:data:bulk:upsert -i <string> -f <filepath> -s <string> [-w <minutes>] [-r] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
259
+ ## `sfdx data:export:tree`
172
260
 
173
- bulk upsert records from a CSV file
261
+ Export data from an org into one or more JSON files.
174
262
 
175
263
  ```
176
264
  USAGE
177
- $ sfdx force:data:bulk:upsert -i <string> -f <filepath> -s <string> [-w <minutes>] [-r] [-u <string>] [--apiversion
178
- <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
265
+ $ sfdx data:export:tree -o <value> -q <value> [--json] [--api-version <value>] [-p] [-x <value>] [-d <value>]
179
266
 
180
267
  FLAGS
181
- -f, --csvfile=<value> (required) the path to the CSV file
182
- that defines the records to upsert
183
- -i, --externalid=<value> (required) the column name of the
184
- external ID
185
- -r, --serial run batches in serial mode
186
- -s, --sobjecttype=<value> (required) the sObject type of the
187
- records you want to upsert
188
- -u, --targetusername=<value> username or alias for the target
189
- org; overrides default target org
190
- -w, --wait=<value> the number of minutes to wait for
191
- the command to complete before
192
- displaying the results
193
- --apiversion=<value> override the api version used for
194
- api requests made by this command
195
- --json format output as json
196
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
197
- this command invocation
268
+ -d, --output-dir=<value> Directory in which to generate the JSON files; default is current directory.
269
+ -o, --target-org=<value> (required) Username or alias of the target org.
270
+ -p, --plan Generate multiple sObject tree files and a plan definition file for aggregated import.
271
+ -q, --query=<value> (required) SOQL query, or filepath of a file that contains the query, to retrieve records.
272
+ -x, --prefix=<value> Prefix of generated files.
273
+ --api-version=<value> Override the api version used for api requests made by this command
198
274
 
199
- DESCRIPTION
200
- bulk upsert records from a CSV file
275
+ GLOBAL FLAGS
276
+ --json Format output as json.
201
277
 
202
- Inserts or updates records from a CSV file.
278
+ DESCRIPTION
279
+ Export data from an org into one or more JSON files.
203
280
 
204
- One job can contain many batches, depending on the length of the CSV file.
281
+ Specify a SOQL query, either directly at the command line or read from a file, to retrieve the data you want to
282
+ export. The exported data is written to JSON files in sObject tree format, which is a collection of nested,
283
+ parent-child records with a single root record. Use these JSON files to import data into an org with the "sfdx data
284
+ import tree" command.
205
285
 
206
- Returns a job ID and a batch ID. Use these IDs to check job status with data:bulk:status.
286
+ If your SOQL query references multiple objects, the command generates a single JSON file by default. You can specify
287
+ the --plan flag to generate separate JSON files for each object and a plan definition file that aggregates them. You
288
+ then specify just this plan definition file when you import the data into an org.
207
289
 
208
- For information about formatting your CSV file, see "Prepare CSV Files" in the Bulk API Developer Guide.
290
+ The SOQL query can return a maximum of 2,000 records. For more information, see the REST API Developer Guide.
291
+ (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm).
209
292
 
210
- By default, the job runs the batches in parallel. Specify --serial to run them serially.
293
+ ALIASES
294
+ $ sfdx force:data:tree:export
211
295
 
212
296
  EXAMPLES
213
- $ sfdx force:data:bulk:upsert -s MyObject__c -f ./path/to/file.csv -i MyField__c
297
+ Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
298
+ uses your default org:
299
+
300
+ $ sfdx data:export:tree --query "SELECT Id, Name, (SELECT Name, Address\_\_c FROM Properties\_\_r) FROM \
301
+ Broker\_\_c"
302
+
303
+ Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
304
+ aggregates them:
305
+
306
+ $ sfdx data:export:tree --query query.txt --plan
214
307
 
215
- $ sfdx force:data:bulk:upsert -s MyObject__c -f ./path/to/file.csv -i Id -w 2
308
+ Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the
309
+ command on the org with alias "my-scratch":
310
+
311
+ $ sfdx data:export:tree --query query.txt --plan --prefix export-demo --output-dir export-out --target-org \
312
+ my-scratch
216
313
  ```
217
314
 
218
- _See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/bulk/upsert.ts)_
315
+ _See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/export/tree.ts)_
219
316
 
220
- ## `sfdx force:data:record:create -s <string> -v <string> [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
317
+ ## `sfdx data:get:record`
221
318
 
222
- creates and inserts a record
319
+ Retrieve and display a single record of a Salesforce or Tooling API object.
223
320
 
224
321
  ```
225
322
  USAGE
226
- $ sfdx force:data:record:create -s <string> -v <string> [-t] [--perflog --json] [-u <string>] [--apiversion <string>]
227
- [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
323
+ $ sfdx data:get:record -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
228
324
 
229
325
  FLAGS
230
- -s, --sobjecttype=<value> (required) the type of the record
231
- you’re creating
232
- -t, --usetoolingapi create the record with tooling api
233
- -u, --targetusername=<value> username or alias for the target
234
- org; overrides default target org
235
- -v, --values=<value> (required) the <fieldName>=<value>
236
- pairs you’re creating
237
- --apiversion=<value> override the api version used for
238
- api requests made by this command
239
- --json format output as json
240
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
241
- this command invocation
242
- --perflog get API performance data
326
+ -i, --record-id=<value> ID of the record you’re retrieving.
327
+ -o, --target-org=<value> (required) Username or alias of the target org.
328
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're retrieving a record
329
+ from.
330
+ -t, --use-tooling-api Use Tooling API so you can retrieve a record from a Tooling API object.
331
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to display.
332
+ --api-version=<value> Override the api version used for api requests made by this command
333
+
334
+ GLOBAL FLAGS
335
+ --json Format output as json.
243
336
 
244
337
  DESCRIPTION
245
- creates and inserts a record
338
+ Retrieve and display a single record of a Salesforce or Tooling API object.
246
339
 
247
- The format of a field-value pair is <fieldName>=<value>.
340
+ Specify the record you want to retrieve with either its ID or with a list of field-value pairs that identify the
341
+ record. If your list of fields identifies more than one record, the command fails; the error displays how many records
342
+ were found.
248
343
 
249
- Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
344
+ When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
345
+ double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
250
346
 
251
- Enclose values that contain spaces in single quotes.
347
+ The command displays all the record's fields and their values, one field per terminal line. Fields with no values are
348
+ displayed as "null".
252
349
 
253
- To get data on API performance metrics, specify both --perflog and --json.
350
+ This command retrieves a record from Salesforce objects by default. Use the --use-tooling-api flag to retrieve from a
351
+ Tooling API object.
352
+
353
+ ALIASES
354
+ $ sfdx force:data:record:get
254
355
 
255
356
  EXAMPLES
256
- $ sfdx force:data:record:create -s Account -v "Name=Acme"
357
+ Retrieve and display a record from Account with the specified (truncated) ID:
358
+
359
+ $ sfdx data:get:record --sobject Account --record-id 00180XX
257
360
 
258
- $ sfdx force:data:record:create -s Account -v "Name='Universal Containers'"
361
+ Retrieve a record from Account whose name equals "Acme":
259
362
 
260
- $ sfdx force:data:record:create -s Account -v "Name='Universal Containers' Website=www.example.com"
363
+ $ sfdx data:get:record --sobject Account --where "Name=Acme"
261
364
 
262
- $ 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"
365
+ Retrieve a record from Account identified with two field values, one that contains a space; the command uses the org
366
+ with alias "my-scratch":
263
367
 
264
- $ sfdx force:data:record:create -s Account -v "Name=Acme" --perflog --json
368
+ $ sfdx data:get:record --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" \
369
+ --target-org myscratch
370
+
371
+ Retrieve a record from the Tooling API object TraceFlag with the specified (truncated) ID:
372
+
373
+ $ sfdx data:get:record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
265
374
  ```
266
375
 
267
- _See code: [src/commands/force/data/record/create.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/record/create.ts)_
376
+ _See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/get/record.ts)_
268
377
 
269
- ## `sfdx force:data:record:delete -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
378
+ ## `sfdx data:import:tree`
270
379
 
271
- deletes a single record
380
+ Import data from one or more JSON files into an org.
272
381
 
273
382
  ```
274
383
  USAGE
275
- $ sfdx force:data:record:delete -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion
276
- <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
384
+ $ sfdx data:import:tree -o <value> [--json] [--api-version <value>] [-f <value> | -p <value>] [--config-help]
277
385
 
278
386
  FLAGS
279
- -i, --sobjectid=<value> the ID of the record you’re deleting
280
- -s, --sobjecttype=<value> (required) the type of the record
281
- you’re deleting
282
- -t, --usetoolingapi delete the record with Tooling API
283
- -u, --targetusername=<value> username or alias for the target
284
- org; overrides default target org
285
- -w, --where=<value> a list of <fieldName>=<value> pairs
286
- to search for
287
- --apiversion=<value> override the api version used for
288
- api requests made by this command
289
- --json format output as json
290
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
291
- this command invocation
292
- --perflog get API performance data
387
+ -f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
388
+ that you want to insert.
389
+ -o, --target-org=<value> (required) Username or alias of the target org.
390
+ -p, --plan=<value> Plan definition file to insert multiple data files.
391
+ --api-version=<value> Override the api version used for api requests made by this command
392
+ --config-help Display schema information for the --plan configuration file to stdout; if you specify this
393
+ flag, all other flags except --json are ignored.
394
+
395
+ GLOBAL FLAGS
396
+ --json Format output as json.
293
397
 
294
398
  DESCRIPTION
295
- deletes a single record
399
+ Import data from one or more JSON files into an org.
400
+
401
+ The JSON files that contain the data are in sObject tree format, which is a collection of nested, parent-child records
402
+ with a single root record. Use the "sfdx data export tree" command to generate these JSON files.
403
+
404
+ If you used the --plan flag when exporting the data to generate a plan definition file, use the --plan flag to
405
+ reference the file when you import. If you're not using a plan, use the --files flag to list the files. If you specify
406
+ multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
407
+ order.
408
+
409
+ The sObject Tree API supports requests that contain up to 200 records. For more information, see the REST API
410
+ Developer Guide.
411
+ (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm)
412
+
413
+ ALIASES
414
+ $ sfdx force:data:tree:import
415
+
416
+ EXAMPLES
417
+ Import the records contained in two JSON files into the org with alias "my-scratch":
418
+
419
+ $ sfdx data:import:tree --files Contact.json,Account.json --target-org my-scratch
296
420
 
297
- Specify an sObject type and either an ID or a list of <fieldName>=<value> pairs.
421
+ Import records using a plan definition file into your default org:
298
422
 
299
- The format of a field-value pair is <fieldName>=<value>.
423
+ $ sfdx data:import:tree --plan Account-Contact-plan.json
424
+ ```
300
425
 
301
- Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
426
+ _See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/import/tree.ts)_
302
427
 
303
- Enclose values that contain spaces in single quotes.
428
+ ## `sfdx data:query`
304
429
 
305
- To get data on API performance metrics, specify both --perflog and --json.
430
+ Execute a SOQL query.
431
+
432
+ ```
433
+ USAGE
434
+ $ sfdx data:query -o <value> [--json] [--api-version <value>] [-q <value>] [-f <value>] [-w <value> [-b | -t]]
435
+ [--async ] [-r human|json|csv]
436
+
437
+ FLAGS
438
+ -b, --bulk Use Bulk API 2.0 to run the query.
439
+ -f, --file=<value> File that contains the SOQL query.
440
+ -o, --target-org=<value> (required) Username or alias of the target org.
441
+ -q, --query=<value> SOQL query to execute.
442
+ -r, --result-format=(human|json|csv) [default: human] Format to display the results; the --json flag overrides this
443
+ flag.
444
+ -t, --use-tooling-api Use Tooling API so you can run queries on Tooling API objects.
445
+ -w, --wait=<value> Time to wait for the command to finish, in minutes.
446
+ --api-version=<value> Override the api version used for api requests made by this command
447
+ --async Use Bulk API 2.0, but don't wait for the job to complete.
448
+
449
+ GLOBAL FLAGS
450
+ --json Format output as json.
451
+
452
+ DESCRIPTION
453
+ Execute a SOQL query.
454
+
455
+ Specify the SOQL query at the command line with the --query flag or read the query from a file with the --file flag.
456
+
457
+ If your query returns more than 10,000 records, specify the --bulk flag. The command then runs the query using Bulk
458
+ API 2.0, which has higher limits than the default API used by the command.
459
+
460
+ When using --bulk, the command waits 3 minutes by default for the query to complete. Use the --wait parameter to
461
+ specify a different number of minutes to wait, or set --wait to 0 to immediately return control to the terminal. If
462
+ you set --wait to 0, or you use the --async flag, or the command simply times out, the command displays an ID. Pass
463
+ this ID to the the "data query resume" command using the --bulk-query-id flag to get the results; pass the ID to the
464
+ "data resume" command to get the job status.
465
+
466
+ ALIASES
467
+ $ sfdx force:data:soql:query
306
468
 
307
469
  EXAMPLES
308
- $ sfdx force:data:record:delete -s Account -i 001D000000Kv3dl
470
+ Specify a SOQL query at the command line; the command uses your default org:
471
+
472
+ $ sfdx data:query --query "SELECT Id, Name, Account.Name FROM Contact"
473
+
474
+ Read the SOQL query from a file called "query.txt"; the command uses the org with alias "my-scratch":
475
+
476
+ $ sfdx data:query --file query.txt --target-org my-scratch
309
477
 
310
- $ sfdx force:data:record:delete -s Account -w "Name=Acme"
478
+ Use Tooling API to run a query on the ApexTrigger Tooling API object:
311
479
 
312
- $ sfdx force:data:record:delete -s Account -w "Name='Universal Containers'"
480
+ $ sfdx data:query --query "SELECT Name FROM ApexTrigger" --use-tooling-api
313
481
 
314
- $ sfdx force:data:record:delete -s Account -w "Name='Universal Containers' Phone='(123) 456-7890'"
482
+ Use Bulk API 2.0 to run a query that returns many rows, and return control to the terminal immediately:
315
483
 
316
- $ sfdx force:data:record:delete -t -s TraceFlag -i 7tf170000009cU6AAI --perflog --json
484
+ $ sfdx data:query --query "SELECT Id FROM Contact" --bulk --wait 0
317
485
  ```
318
486
 
319
- _See code: [src/commands/force/data/record/delete.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/record/delete.ts)_
487
+ _See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/query.ts)_
320
488
 
321
- ## `sfdx force:data:record:get -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
489
+ ## `sfdx data:query:resume`
322
490
 
323
- displays a single record
491
+ View the status of a bulk query.
324
492
 
325
493
  ```
326
494
  USAGE
327
- $ sfdx force:data:record:get -s <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion
328
- <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
495
+ $ sfdx data:query:resume -o <value> -i <value> [--json] [--api-version <value>] [-r human|json|csv]
329
496
 
330
497
  FLAGS
331
- -i, --sobjectid=<value> the ID of the record you’re
332
- retrieving
333
- -s, --sobjecttype=<value> (required) the type of the record
334
- you’re retrieving
335
- -t, --usetoolingapi retrieve the record with Tooling API
336
- -u, --targetusername=<value> username or alias for the target
337
- org; overrides default target org
338
- -w, --where=<value> a list of <fieldName>=<value> pairs
339
- to search for
340
- --apiversion=<value> override the api version used for
341
- api requests made by this command
342
- --json format output as json
343
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
344
- this command invocation
345
- --perflog get API performance data
498
+ -i, --bulk-query-id=<value> (required) Job ID of the bulk query.
499
+ -o, --target-org=<value> (required) Username or alias of the target org.
500
+ -r, --result-format=(human|json|csv) [default: human] Format to display the results; the --json flag overrides this
501
+ flag.
502
+ --api-version=<value> Override the api version used for api requests made by this command
503
+
504
+ GLOBAL FLAGS
505
+ --json Format output as json.
506
+
507
+ DESCRIPTION
508
+ View the status of a bulk query.
509
+
510
+ Run this command using the job ID returned from the "sfdx data query --bulk" command.
511
+
512
+ ALIASES
513
+ $ sfdx force:data:soql:bulk:report
514
+
515
+ EXAMPLES
516
+ View the status of a bulk query with the specified ID:
517
+
518
+ $ sfdx data:query:resume --bulk-query-id 7500x000005BdFzXXX
519
+ ```
520
+
521
+ _See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/query/resume.ts)_
522
+
523
+ ## `sfdx data:resume`
524
+
525
+ View the status of a bulk data load job or batch.
526
+
527
+ ```
528
+ USAGE
529
+ $ sfdx data:resume -o <value> -i <value> [--json] [--api-version <value>] [-b <value>]
530
+
531
+ FLAGS
532
+ -b, --batch-id=<value> ID of the batch whose status you want to view; you must also specify the job ID.
533
+ -i, --job-id=<value> (required) ID of the job whose status you want to view.
534
+ -o, --target-org=<value> (required) Username or alias of the target org.
535
+ --api-version=<value> Override the api version used for api requests made by this command
536
+
537
+ GLOBAL FLAGS
538
+ --json Format output as json.
346
539
 
347
540
  DESCRIPTION
348
- displays a single record
541
+ View the status of a bulk data load job or batch.
542
+
543
+ Run this command using the job ID or batch ID returned from the "sfdx data delete bulk" or "sfdx data upsert bulk"
544
+ commands.
545
+
546
+ ALIASES
547
+ $ sfdx force:data:bulk:status
548
+
549
+ EXAMPLES
550
+ View the status of a bulk load job:
551
+
552
+ $ sfdx data:resume --job-id 750xx000000005sAAA
553
+
554
+ View the status of a bulk load job and a specific batches:
555
+
556
+ $ sfdx data:resume --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA
557
+ ```
558
+
559
+ _See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/resume.ts)_
560
+
561
+ ## `sfdx data:update:record`
562
+
563
+ Updates a single record of a Salesforce or Tooling API object.
564
+
565
+ ```
566
+ USAGE
567
+ $ sfdx data:update:record -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-i <value>] [-w <value>]
568
+ [-t]
569
+
570
+ FLAGS
571
+ -i, --record-id=<value> ID of the record you’re updating.
572
+ -o, --target-org=<value> (required) Username or alias of the target org.
573
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that contains the record you're
574
+ updating.
575
+ -t, --use-tooling-api Use Tooling API so you can update a record in a Tooling API object.
576
+ -v, --values=<value> (required) Fields that you're updating, in the format of <fieldName>=<value> pairs.
577
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to update.
578
+ --api-version=<value> Override the api version used for api requests made by this command
579
+
580
+ GLOBAL FLAGS
581
+ --json Format output as json.
349
582
 
350
- Specify an sObject type and either an ID or a list of <fieldName>=<value> pairs.
583
+ DESCRIPTION
584
+ Updates a single record of a Salesforce or Tooling API object.
351
585
 
352
- The format of a field-value pair is <fieldName>=<value>.
586
+ Specify the record you want to update with either its ID or with a list of field-value pairs that identify the record.
587
+ If your list of fields identifies more than one record, the delete fails; the error displays how many records were
588
+ found.
353
589
 
354
- Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
590
+ When using field-value pairs for both identifying the record and specifiyng the new field values, use the format
591
+ <fieldName>=<value>. Enclose all field-value pairs in one set of double quotation marks, delimited by spaces. Enclose
592
+ values that contain spaces in single quotes.
355
593
 
356
- Enclose values that contain spaces in single quotes.
594
+ This command updates a record in Salesforce objects by default. Use the --use-tooling-api flag to update a Tooling API
595
+ object.
357
596
 
358
- To get data on API performance metrics, specify both --perflog and --json.
597
+ ALIASES
598
+ $ sfdx force:data:record:update
359
599
 
360
600
  EXAMPLES
361
- $ sfdx force:data:record:get -s Account -i 001D000000Kv3dl
601
+ Update the Name field of an Account record with the specified (truncated) ID:
602
+
603
+ $ sfdx data:update:record --sobject Account --record-id 001D0 --values "Name=NewAcme"
604
+
605
+ Update the Name field of an Account record whose current name is 'Old Acme':
606
+
607
+ $ sfdx data:update:record --sobject Account --where "Name='Old Acme'" --values "Name='New Acme'"
362
608
 
363
- $ sfdx force:data:record:get -s Account -w "Name=Acme"
609
+ Update the Name and Website fields of an Account record with the specified (truncated) ID:
364
610
 
365
- $ sfdx force:data:record:get -s Account -w "Name='Universal Containers'"
611
+ $ sfdx data:update:record --sobject Account --record-id 001D0 --values "Name='Acme III' Website=www.example.com"
366
612
 
367
- $ sfdx force:data:record:get -s Account -w "Name='Universal Containers' Phone='(123) 456-7890'"
613
+ Update the ExpirationDate field of a record of the Tooling API object TraceFlag using the specified (truncated) ID:
368
614
 
369
- $ sfdx force:data:record:get -t -s TraceFlag -i 7tf170000009cUBAAY --perflog --json
615
+ $ sfdx data:update:record -t --sobject TraceFlag --record-id 7tf170000009cUBAAY --values \
616
+ "ExpirationDate=2017-12-01T00:58:04.000+0000"
370
617
  ```
371
618
 
372
- _See code: [src/commands/force/data/record/get.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/record/get.ts)_
619
+ _See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/update/record.ts)_
373
620
 
374
- ## `sfdx force:data:record:update -s <string> -v <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
621
+ ## `sfdx data:upsert:bulk`
375
622
 
376
- updates a single record
623
+ Bulk upsert records to an org from a CSV file.
377
624
 
378
625
  ```
379
626
  USAGE
380
- $ sfdx force:data:record:update -s <string> -v <string> [-i <id> | -w <string>] [-t] [--perflog --json] [-u <string>]
381
- [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
627
+ $ sfdx data:upsert:bulk -o <value> -i <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
628
+ [-r]
382
629
 
383
630
  FLAGS
384
- -i, --sobjectid=<value> the ID of the record you’re updating
385
- -s, --sobjecttype=<value> (required) the sObject type of the
386
- record you’re updating
387
- -t, --usetoolingapi update the record with Tooling API
388
- -u, --targetusername=<value> username or alias for the target
389
- org; overrides default target org
390
- -v, --values=<value> (required) the <fieldName>=<value>
391
- pairs you’re updating
392
- -w, --where=<value> a list of <fieldName>=<value> pairs
393
- to search for
394
- --apiversion=<value> override the api version used for
395
- api requests made by this command
396
- --json format output as json
397
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
398
- this command invocation
399
- --perflog get API performance data
631
+ -f, --file=<value> (required) CSV file that contains the records to upsert.
632
+ -i, --external-id=<value> (required) Name of the external ID field, or the Id field.
633
+ -o, --target-org=<value> (required) Username or alias of the target org.
634
+ -r, --serial Run batches in serial mode.
635
+ -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
636
+ upsert records to.
637
+ -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
638
+ displaying the results.
639
+ --api-version=<value> Override the api version used for api requests made by this command
640
+
641
+ GLOBAL FLAGS
642
+ --json Format output as json.
400
643
 
401
644
  DESCRIPTION
402
- updates a single record
645
+ Bulk upsert records to an org from a CSV file.
403
646
 
404
- The format of a field-value pair is <fieldName>=<value>.
647
+ An upsert refers to inserting a record into a Salesforce object if the record doesn't already exist, or updating it if
648
+ it does exist.
405
649
 
406
- Enclose all field-value pairs in one set of double quotation marks, delimited by spaces.
650
+ When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
651
+ returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
652
+ minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
653
+ the "sfdx data resume" command. A single job can contain many batches, depending on the length of the CSV file.
407
654
 
408
- Enclose values that contain spaces in single quotes.
655
+ See "Prepare CSV Files" in the Bulk API Developer Guide for details on formatting your CSV file.
656
+ (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm)
409
657
 
410
- To get data on API performance metrics, specify both --perflog and --json.
658
+ By default, the job runs the batches in parallel, which we recommend. You can run jobs serially by specifying the
659
+ --serial flag. But don't process data in serial mode unless you know this would otherwise result in lock timeouts and
660
+ you can't reorganize your batches to avoid the locks.
661
+
662
+ ALIASES
663
+ $ sfdx force:data:bulk:upsert
411
664
 
412
665
  EXAMPLES
413
- $ sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name=NewAcme"
666
+ Bulk upsert records to the Contact object:
667
+
668
+ $ sfdx --sobject Contact --file files/contacts.csv --external-id Id
414
669
 
415
- $ sfdx force:data:record:update -s Account -w "Name='Old Acme'" -v "Name='New Acme'"
670
+ Bulk upsert records to a custom object and wait 5 minutes for the command to complete:
671
+
672
+ $ sfdx data:upsert:bulk --sobject MyObject__c --file files/file.csv --external-id MyField__c --wait 5
673
+ ```
416
674
 
417
- $ sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name='Acme III' Website=www.example.com"
675
+ _See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.21/src/commands/data/upsert/bulk.ts)_
418
676
 
419
- $ sfdx force:data:record:update -t -s TraceFlag -i 7tf170000009cUBAAY -v "ExpirationDate=2017-12-01T00:58:04.000+0000"
677
+ ## `sfdx force:data:bulk:delete`
678
+
679
+ Bulk delete records from an org using a CSV file.
420
680
 
421
- $sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name=NewAcme" --perflog --json
422
681
  ```
682
+ USAGE
683
+ $ sfdx force:data:bulk:delete -o <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
684
+
685
+ FLAGS
686
+ -f, --file=<value> (required) CSV file that contains the IDs of the records to delete.
687
+ -o, --target-org=<value> (required) Username or alias of the target org.
688
+ -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
689
+ delete records from.
690
+ -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before displaying
691
+ the results.
692
+ --api-version=<value> Override the api version used for api requests made by this command
693
+
694
+ GLOBAL FLAGS
695
+ --json Format output as json.
696
+
697
+ DESCRIPTION
698
+ Bulk delete records from an org using a CSV file.
699
+
700
+ The CSV file must have only one column ("Id") and then the list of record IDs you want to delete, one ID per line.
423
701
 
424
- _See code: [src/commands/force/data/record/update.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/record/update.ts)_
702
+ When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
703
+ returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
704
+ minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
705
+ the "sfdx data resume" command. A single job can contain many batches, depending on the length of the CSV file.
425
706
 
426
- ## `sfdx force:data:soql:bulk:report -i <string> [-r human|csv|json] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
707
+ ALIASES
708
+ $ sfdx force:data:bulk:delete
427
709
 
428
- view the status of a bulk query
710
+ EXAMPLES
711
+ Bulk delete Account records using the list of IDs in the "files/delete.csv" file:
712
+
713
+ $ sfdx force:data:bulk:delete --sobject Account --file files/delete.csv
714
+
715
+ Bulk delete records from a custom object and wait 5 minutes for the command to complete:
716
+
717
+ $ sfdx force:data:bulk:delete --sobject MyObject__c --file files/delete.csv --wait 5
718
+ ```
719
+
720
+ ## `sfdx force:data:bulk:status`
721
+
722
+ View the status of a bulk data load job or batch.
429
723
 
430
724
  ```
431
725
  USAGE
432
- $ sfdx force:data:soql:bulk:report -i <string> [-r human|csv|json] [-u <string>] [--apiversion <string>] [--json] [--loglevel
433
- trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
726
+ $ sfdx force:data:bulk:status -o <value> -i <value> [--json] [--api-version <value>] [-b <value>]
434
727
 
435
728
  FLAGS
436
- -i, --bulkqueryid=<value> (required) the job ID of the bulk
437
- query
438
- -r, --resultformat=(human|csv|json) [default: human] result format
439
- emitted to stdout; --json flag
440
- overrides this parameter
441
- -u, --targetusername=<value> username or alias for the target
442
- org; overrides default target org
443
- --apiversion=<value> override the api version used for
444
- api requests made by this command
445
- --json format output as json
446
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
447
- this command invocation
729
+ -b, --batch-id=<value> ID of the batch whose status you want to view; you must also specify the job ID.
730
+ -i, --job-id=<value> (required) ID of the job whose status you want to view.
731
+ -o, --target-org=<value> (required) Username or alias of the target org.
732
+ --api-version=<value> Override the api version used for api requests made by this command
733
+
734
+ GLOBAL FLAGS
735
+ --json Format output as json.
448
736
 
449
737
  DESCRIPTION
450
- view the status of a bulk query
738
+ View the status of a bulk data load job or batch.
451
739
 
452
- Run this command using the job ID returned from the force:data:soql:query --bulk command.
740
+ Run this command using the job ID or batch ID returned from the "sfdx data delete bulk" or "sfdx data upsert bulk"
741
+ commands.
742
+
743
+ ALIASES
744
+ $ sfdx force:data:bulk:status
453
745
 
454
746
  EXAMPLES
455
- $ sfdx force:data:soql:bulk:report -i 7500x000005BdFzXXX
747
+ View the status of a bulk load job:
748
+
749
+ $ sfdx force:data:bulk:status --job-id 750xx000000005sAAA
750
+
751
+ View the status of a bulk load job and a specific batches:
752
+
753
+ $ sfdx force:data:bulk:status --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA
456
754
  ```
457
755
 
458
- _See code: [src/commands/force/data/soql/bulk/report.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/soql/bulk/report.ts)_
756
+ ## `sfdx force:data:bulk:upsert`
459
757
 
460
- ## `sfdx force:data:soql:query [-q <string> | -f <filepath>] [-w <minutes> [-b | -t]] [-r human|csv|json] [--perflog --json] [-u <string>] [--apiversion <string>] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
758
+ Bulk upsert records to an org from a CSV file.
461
759
 
462
- execute a SOQL query
760
+ ```
761
+ USAGE
762
+ $ sfdx force:data:bulk:upsert -o <value> -i <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
763
+ [-r]
764
+
765
+ FLAGS
766
+ -f, --file=<value> (required) CSV file that contains the records to upsert.
767
+ -i, --external-id=<value> (required) Name of the external ID field, or the Id field.
768
+ -o, --target-org=<value> (required) Username or alias of the target org.
769
+ -r, --serial Run batches in serial mode.
770
+ -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
771
+ upsert records to.
772
+ -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
773
+ displaying the results.
774
+ --api-version=<value> Override the api version used for api requests made by this command
775
+
776
+ GLOBAL FLAGS
777
+ --json Format output as json.
778
+
779
+ DESCRIPTION
780
+ Bulk upsert records to an org from a CSV file.
781
+
782
+ An upsert refers to inserting a record into a Salesforce object if the record doesn't already exist, or updating it if
783
+ it does exist.
784
+
785
+ When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
786
+ returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
787
+ minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
788
+ the "sfdx data resume" command. A single job can contain many batches, depending on the length of the CSV file.
789
+
790
+ See "Prepare CSV Files" in the Bulk API Developer Guide for details on formatting your CSV file.
791
+ (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm)
792
+
793
+ By default, the job runs the batches in parallel, which we recommend. You can run jobs serially by specifying the
794
+ --serial flag. But don't process data in serial mode unless you know this would otherwise result in lock timeouts and
795
+ you can't reorganize your batches to avoid the locks.
796
+
797
+ ALIASES
798
+ $ sfdx force:data:bulk:upsert
799
+
800
+ EXAMPLES
801
+ Bulk upsert records to the Contact object:
802
+
803
+ $ sfdx --sobject Contact --file files/contacts.csv --external-id Id
804
+
805
+ Bulk upsert records to a custom object and wait 5 minutes for the command to complete:
806
+
807
+ $ sfdx force:data:bulk:upsert --sobject MyObject__c --file files/file.csv --external-id MyField__c --wait 5
808
+ ```
809
+
810
+ ## `sfdx force:data:record:create`
811
+
812
+ Create and insert a record into a Salesforce or Tooling API object.
813
+
814
+ ```
815
+ USAGE
816
+ $ sfdx force:data:record:create -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-t]
817
+
818
+ FLAGS
819
+ -o, --target-org=<value> (required) Username or alias of the target org.
820
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're inserting a record
821
+ into.
822
+ -t, --use-tooling-api Use Tooling API so you can insert a record in a Tooling API object.
823
+ -v, --values=<value> (required) Values for the flags in the form <fieldName>=<value>, separate multiple pairs
824
+ with spaces.
825
+ --api-version=<value> Override the api version used for api requests made by this command
826
+
827
+ GLOBAL FLAGS
828
+ --json Format output as json.
829
+
830
+ DESCRIPTION
831
+ Create and insert a record into a Salesforce or Tooling API object.
832
+
833
+ You must specify a value for all required fields of the object.
834
+
835
+ When specifying fields, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of double
836
+ quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
837
+
838
+ This command inserts a record into Salesforce objects by default. Use the --use-tooling-api flag to insert into a
839
+ Tooling API object.
840
+
841
+ ALIASES
842
+ $ sfdx force:data:record:create
843
+
844
+ EXAMPLES
845
+ Insert a record into the Account object of your default org; only the required Name field has a value:
846
+
847
+ $ sfdx force:data:record:create --sobject Account --values "Name=Acme"
848
+
849
+ Insert an Account record with values for two fields, one value contains a space; the command uses the org with alias
850
+ "my-scratch":
851
+
852
+ $ sfdx force:data:record:create --sobject Account --values "Name='Universal Containers' Website=www.example.com" \
853
+ --target-org my-scratch
854
+
855
+ Insert a record into the Tooling API object TraceFlag:
856
+
857
+ $ sfdx force:data:record:create --use-tooling-api --sobject TraceFlag --values "DebugLevelId=7dl170000008U36AAE \
858
+ StartDate=2022-12-15T00:26:04.000+0000 ExpirationDate=2022-12-15T00:56:04.000+0000 LogType=CLASS_TRACING \
859
+ TracedEntityId=01p17000000R6bLAAS"
860
+ ```
861
+
862
+ ## `sfdx force:data:record:delete`
863
+
864
+ Deletes a single record from a Salesforce or Tooling API object.
865
+
866
+ ```
867
+ USAGE
868
+ $ sfdx force:data:record:delete -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
869
+
870
+ FLAGS
871
+ -i, --record-id=<value> ID of the record you’re deleting.
872
+ -o, --target-org=<value> (required) Username or alias of the target org.
873
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're deleting a record
874
+ from.
875
+ -t, --use-tooling-api Use Tooling API so you can delete a record from a Tooling API object.
876
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to delete.
877
+ --api-version=<value> Override the api version used for api requests made by this command
878
+
879
+ GLOBAL FLAGS
880
+ --json Format output as json.
881
+
882
+ DESCRIPTION
883
+ Deletes a single record from a Salesforce or Tooling API object.
884
+
885
+ Specify the record you want to delete with either its ID or with a list of field-value pairs that identify the record.
886
+ If your list of fields identifies more than one record, the delete fails; the error displays how many records were
887
+ found.
888
+
889
+ When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
890
+ double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
891
+
892
+ This command deletes a record from Salesforce objects by default. Use the --use-tooling-api flag to delete from a
893
+ Tooling API object.
894
+
895
+ ALIASES
896
+ $ sfdx force:data:record:delete
897
+
898
+ EXAMPLES
899
+ Delete a record from Account with the specified (truncated) ID:
900
+
901
+ $ sfdx force:data:record:delete --sobject Account --record-id 00180XX
902
+
903
+ Delete a record from Account whose name equals "Acme":
904
+
905
+ $ sfdx force:data:record:delete --sobject Account --where "Name=Acme"
906
+
907
+ Delete a record from Account identified with two field values, one that contains a space; the command uses the org
908
+ with alias "my-scratch":
909
+
910
+ $ sfdx force:data:record:delete --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" \
911
+ --target-org myscratch
912
+
913
+ Delete a record from the Tooling API object TraceFlag with the specified (truncated) ID:
914
+
915
+ $ sfdx force:data:record:delete --use-tooling-api --sobject TraceFlag --record-id 7tf8c
916
+ ```
917
+
918
+ ## `sfdx force:data:record:get`
919
+
920
+ Retrieve and display a single record of a Salesforce or Tooling API object.
463
921
 
464
922
  ```
465
923
  USAGE
466
- $ sfdx force:data:soql:query [-q <string> | -f <filepath>] [-w <minutes> [-b | -t]] [-r human|csv|json] [--perflog
467
- --json] [-u <string>] [--apiversion <string>] [--loglevel
468
- trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
924
+ $ sfdx force:data:record:get -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
469
925
 
470
926
  FLAGS
471
- -b, --bulk use the bulk 2.0 API to query data
472
- -f, --soqlqueryfile=<value> A SOQL query stored in a file
473
- -q, --query=<value> SOQL query to execute
474
- -r, --resultformat=(human|csv|json) [default: human] result format
475
- emitted to stdout; --json flag
476
- overrides this parameter
477
- -t, --usetoolingapi execute query with Tooling API
478
- -u, --targetusername=<value> username or alias for the target
479
- org; overrides default target org
480
- -w, --wait=<value> wait time for command to finish in
481
- minutes
482
- --apiversion=<value> override the api version used for
483
- api requests made by this command
484
- --json format output as json
485
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
486
- this command invocation
487
- --perflog get API performance data
927
+ -i, --record-id=<value> ID of the record you’re retrieving.
928
+ -o, --target-org=<value> (required) Username or alias of the target org.
929
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're retrieving a record
930
+ from.
931
+ -t, --use-tooling-api Use Tooling API so you can retrieve a record from a Tooling API object.
932
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to display.
933
+ --api-version=<value> Override the api version used for api requests made by this command
934
+
935
+ GLOBAL FLAGS
936
+ --json Format output as json.
488
937
 
489
938
  DESCRIPTION
490
- execute a SOQL query
939
+ Retrieve and display a single record of a Salesforce or Tooling API object.
940
+
941
+ Specify the record you want to retrieve with either its ID or with a list of field-value pairs that identify the
942
+ record. If your list of fields identifies more than one record, the command fails; the error displays how many records
943
+ were found.
944
+
945
+ When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
946
+ double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
491
947
 
492
- When you execute this command in a project, it executes the query against the data in your default scratch org.
948
+ The command displays all the record's fields and their values, one field per terminal line. Fields with no values are
949
+ displayed as "null".
493
950
 
494
- To get data on API performance metrics, specify both --perflog and --json.
951
+ This command retrieves a record from Salesforce objects by default. Use the --use-tooling-api flag to retrieve from a
952
+ Tooling API object.
953
+
954
+ ALIASES
955
+ $ sfdx force:data:record:get
495
956
 
496
957
  EXAMPLES
497
- $ sfdx force:data:soql:query -q "SELECT Id, Name, Account.Name FROM Contact"
958
+ Retrieve and display a record from Account with the specified (truncated) ID:
959
+
960
+ $ sfdx force:data:record:get --sobject Account --record-id 00180XX
961
+
962
+ Retrieve a record from Account whose name equals "Acme":
963
+
964
+ $ sfdx force:data:record:get --sobject Account --where "Name=Acme"
498
965
 
499
- $ sfdx force:data:soql:query -q "SELECT Id, Name FROM Account WHERE ShippingState IN ('CA', 'NY')"
966
+ Retrieve a record from Account identified with two field values, one that contains a space; the command uses the org
967
+ with alias "my-scratch":
500
968
 
501
- $ sfdx force:data:soql:query -q "SELECT Id, Name FROM Account WHERE ShippingState IN ('CA', 'NY')" --perflog --json
969
+ $ sfdx force:data:record:get --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" \
970
+ --target-org myscratch
502
971
 
503
- $ sfdx force:data:soql:query -q "SELECT Name FROM ApexTrigger" -t
972
+ Retrieve a record from the Tooling API object TraceFlag with the specified (truncated) ID:
504
973
 
505
- $ sfdx force:data:soql:query --soqlqueryfile query.txt
974
+ $ sfdx force:data:record:get --use-tooling-api --sobject TraceFlag --record-id 7tf8c
975
+ ```
976
+
977
+ ## `sfdx force:data:record:update`
978
+
979
+ Updates a single record of a Salesforce or Tooling API object.
506
980
 
507
- $ sfdx force:data:soql:query --soqlqueryfile query.txt -t
508
981
  ```
982
+ USAGE
983
+ $ sfdx force:data:record:update -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-i <value>] [-w <value>]
984
+ [-t]
985
+
986
+ FLAGS
987
+ -i, --record-id=<value> ID of the record you’re updating.
988
+ -o, --target-org=<value> (required) Username or alias of the target org.
989
+ -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that contains the record you're
990
+ updating.
991
+ -t, --use-tooling-api Use Tooling API so you can update a record in a Tooling API object.
992
+ -v, --values=<value> (required) Fields that you're updating, in the format of <fieldName>=<value> pairs.
993
+ -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to update.
994
+ --api-version=<value> Override the api version used for api requests made by this command
995
+
996
+ GLOBAL FLAGS
997
+ --json Format output as json.
998
+
999
+ DESCRIPTION
1000
+ Updates a single record of a Salesforce or Tooling API object.
1001
+
1002
+ Specify the record you want to update with either its ID or with a list of field-value pairs that identify the record.
1003
+ If your list of fields identifies more than one record, the delete fails; the error displays how many records were
1004
+ found.
1005
+
1006
+ When using field-value pairs for both identifying the record and specifiyng the new field values, use the format
1007
+ <fieldName>=<value>. Enclose all field-value pairs in one set of double quotation marks, delimited by spaces. Enclose
1008
+ values that contain spaces in single quotes.
1009
+
1010
+ This command updates a record in Salesforce objects by default. Use the --use-tooling-api flag to update a Tooling API
1011
+ object.
1012
+
1013
+ ALIASES
1014
+ $ sfdx force:data:record:update
1015
+
1016
+ EXAMPLES
1017
+ Update the Name field of an Account record with the specified (truncated) ID:
1018
+
1019
+ $ sfdx force:data:record:update --sobject Account --record-id 001D0 --values "Name=NewAcme"
1020
+
1021
+ Update the Name field of an Account record whose current name is 'Old Acme':
1022
+
1023
+ $ sfdx force:data:record:update --sobject Account --where "Name='Old Acme'" --values "Name='New Acme'"
509
1024
 
510
- _See code: [src/commands/force/data/soql/query.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/soql/query.ts)_
1025
+ Update the Name and Website fields of an Account record with the specified (truncated) ID:
511
1026
 
512
- ## `sfdx force:data:tree:export -q <string> [-p] [-x <string>] [-d <directory>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
1027
+ $ sfdx force:data:record:update --sobject Account --record-id 001D0 --values "Name='Acme III' \
1028
+ Website=www.example.com"
513
1029
 
514
- export data from an org
1030
+ Update the ExpirationDate field of a record of the Tooling API object TraceFlag using the specified (truncated) ID:
1031
+
1032
+ $ sfdx force:data:record:update -t --sobject TraceFlag --record-id 7tf170000009cUBAAY --values \
1033
+ "ExpirationDate=2017-12-01T00:58:04.000+0000"
1034
+ ```
1035
+
1036
+ ## `sfdx force:data:soql:bulk:report`
1037
+
1038
+ View the status of a bulk query.
515
1039
 
516
1040
  ```
517
1041
  USAGE
518
- $ sfdx force:data:tree:export -q <string> [-p] [-x <string>] [-d <directory>] [-u <string>] [--apiversion <string>]
519
- [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
1042
+ $ sfdx force:data:soql:bulk:report -o <value> -i <value> [--json] [--api-version <value>] [-r human|json|csv]
520
1043
 
521
1044
  FLAGS
522
- -d, --outputdir=<value> directory to store files'
523
- -p, --plan generate mulitple sobject tree files
524
- and a plan definition file for
525
- aggregated import
526
- -q, --query=<value> (required) soql query, or filepath
527
- of file containing a soql query, to
528
- retrieve records
529
- -u, --targetusername=<value> username or alias for the target
530
- org; overrides default target org
531
- -x, --prefix=<value> prefix of generated files
532
- --apiversion=<value> override the api version used for
533
- api requests made by this command
534
- --json format output as json
535
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
536
- this command invocation
1045
+ -i, --bulk-query-id=<value> (required) Job ID of the bulk query.
1046
+ -o, --target-org=<value> (required) Username or alias of the target org.
1047
+ -r, --result-format=(human|json|csv) [default: human] Format to display the results; the --json flag overrides this
1048
+ flag.
1049
+ --api-version=<value> Override the api version used for api requests made by this command
1050
+
1051
+ GLOBAL FLAGS
1052
+ --json Format output as json.
537
1053
 
538
1054
  DESCRIPTION
539
- export data from an org
1055
+ View the status of a bulk query.
540
1056
 
541
- Exports data from an org into sObject tree format for use with the force:data:tree:import command.
1057
+ Run this command using the job ID returned from the "sfdx data query --bulk" command.
542
1058
 
543
- The query for export can return a maximum of 2,000 records. For more information, see the REST API Developer Guide:
544
- https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
1059
+ ALIASES
1060
+ $ sfdx force:data:soql:bulk:report
545
1061
 
546
1062
  EXAMPLES
547
- $ sfdx force:data:tree:export -q "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM Broker__c"
1063
+ View the status of a bulk query with the specified ID:
1064
+
1065
+ $ sfdx force:data:soql:bulk:report --bulk-query-id 7500x000005BdFzXXX
1066
+ ```
1067
+
1068
+ ## `sfdx force:data:soql:query`
1069
+
1070
+ Execute a SOQL query.
548
1071
 
549
- $ sfdx force:data:tree:export -q <path to file containing soql query> -x export-demo -d /tmp/sfdx-out -p
550
1072
  ```
1073
+ USAGE
1074
+ $ sfdx force:data:soql:query -o <value> [--json] [--api-version <value>] [-q <value>] [-f <value>] [-w <value> [-b | -t]]
1075
+ [--async ] [-r human|json|csv]
1076
+
1077
+ FLAGS
1078
+ -b, --bulk Use Bulk API 2.0 to run the query.
1079
+ -f, --file=<value> File that contains the SOQL query.
1080
+ -o, --target-org=<value> (required) Username or alias of the target org.
1081
+ -q, --query=<value> SOQL query to execute.
1082
+ -r, --result-format=(human|json|csv) [default: human] Format to display the results; the --json flag overrides this
1083
+ flag.
1084
+ -t, --use-tooling-api Use Tooling API so you can run queries on Tooling API objects.
1085
+ -w, --wait=<value> Time to wait for the command to finish, in minutes.
1086
+ --api-version=<value> Override the api version used for api requests made by this command
1087
+ --async Use Bulk API 2.0, but don't wait for the job to complete.
1088
+
1089
+ GLOBAL FLAGS
1090
+ --json Format output as json.
1091
+
1092
+ DESCRIPTION
1093
+ Execute a SOQL query.
1094
+
1095
+ Specify the SOQL query at the command line with the --query flag or read the query from a file with the --file flag.
1096
+
1097
+ If your query returns more than 10,000 records, specify the --bulk flag. The command then runs the query using Bulk
1098
+ API 2.0, which has higher limits than the default API used by the command.
1099
+
1100
+ When using --bulk, the command waits 3 minutes by default for the query to complete. Use the --wait parameter to
1101
+ specify a different number of minutes to wait, or set --wait to 0 to immediately return control to the terminal. If
1102
+ you set --wait to 0, or you use the --async flag, or the command simply times out, the command displays an ID. Pass
1103
+ this ID to the the "data query resume" command using the --bulk-query-id flag to get the results; pass the ID to the
1104
+ "data resume" command to get the job status.
551
1105
 
552
- _See code: [src/commands/force/data/tree/export.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/tree/export.ts)_
1106
+ ALIASES
1107
+ $ sfdx force:data:soql:query
553
1108
 
554
- ## `sfdx force:data:tree:import [-f <array> | -p <filepath>] [--confighelp] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
1109
+ EXAMPLES
1110
+ Specify a SOQL query at the command line; the command uses your default org:
1111
+
1112
+ $ sfdx force:data:soql:query --query "SELECT Id, Name, Account.Name FROM Contact"
1113
+
1114
+ Read the SOQL query from a file called "query.txt"; the command uses the org with alias "my-scratch":
1115
+
1116
+ $ sfdx force:data:soql:query --file query.txt --target-org my-scratch
1117
+
1118
+ Use Tooling API to run a query on the ApexTrigger Tooling API object:
555
1119
 
556
- import data into an org
1120
+ $ sfdx force:data:soql:query --query "SELECT Name FROM ApexTrigger" --use-tooling-api
1121
+
1122
+ Use Bulk API 2.0 to run a query that returns many rows, and return control to the terminal immediately:
1123
+
1124
+ $ sfdx force:data:soql:query --query "SELECT Id FROM Contact" --bulk --wait 0
1125
+ ```
1126
+
1127
+ ## `sfdx force:data:tree:export`
1128
+
1129
+ Export data from an org into one or more JSON files.
557
1130
 
558
1131
  ```
559
1132
  USAGE
560
- $ sfdx force:data:tree:import [-f <array> | -p <filepath>] [--confighelp] [-u <string>] [--apiversion <string>] [--json]
561
- [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
1133
+ $ sfdx force:data:tree:export -o <value> -q <value> [--json] [--api-version <value>] [-p] [-x <value>] [-d <value>]
562
1134
 
563
1135
  FLAGS
564
- -f, --sobjecttreefiles=<value> comma-delimited, ordered paths of
565
- json files containing collection of
566
- record trees to insert
567
- -p, --plan=<value> path to plan to insert multiple data
568
- files that have master-detail
569
- relationships
570
- -u, --targetusername=<value> username or alias for the target
571
- org; overrides default target org
572
- --apiversion=<value> override the api version used for
573
- api requests made by this command
574
- --confighelp display schema information for the
575
- --plan configuration file to stdout;
576
- if you use this option, all other
577
- options except --json are ignored
578
- --json format output as json
579
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
580
- this command invocation
1136
+ -d, --output-dir=<value> Directory in which to generate the JSON files; default is current directory.
1137
+ -o, --target-org=<value> (required) Username or alias of the target org.
1138
+ -p, --plan Generate multiple sObject tree files and a plan definition file for aggregated import.
1139
+ -q, --query=<value> (required) SOQL query, or filepath of a file that contains the query, to retrieve records.
1140
+ -x, --prefix=<value> Prefix of generated files.
1141
+ --api-version=<value> Override the api version used for api requests made by this command
1142
+
1143
+ GLOBAL FLAGS
1144
+ --json Format output as json.
581
1145
 
582
1146
  DESCRIPTION
583
- import data into an org
1147
+ Export data from an org into one or more JSON files.
584
1148
 
585
- IMPORTANT: Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained
586
- certain terms to avoid any effect on customer implementations.
1149
+ Specify a SOQL query, either directly at the command line or read from a file, to retrieve the data you want to
1150
+ export. The exported data is written to JSON files in sObject tree format, which is a collection of nested,
1151
+ parent-child records with a single root record. Use these JSON files to import data into an org with the "sfdx data
1152
+ import tree" command.
587
1153
 
588
- Imports data into an org using the SObject Tree Save API. This data can include master-detail relationships.
1154
+ If your SOQL query references multiple objects, the command generates a single JSON file by default. You can specify
1155
+ the --plan flag to generate separate JSON files for each object and a plan definition file that aggregates them. You
1156
+ then specify just this plan definition file when you import the data into an org.
589
1157
 
590
- To generate JSON files for use with force:data:tree:import, run "sfdx force:data:tree:export".
1158
+ The SOQL query can return a maximum of 2,000 records. For more information, see the REST API Developer Guide.
1159
+ (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm).
591
1160
 
592
- The SObject Tree API supports requests that contain up to 200 records. For more information, see the REST API
593
- Developer Guide:
594
- https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
1161
+ ALIASES
1162
+ $ sfdx force:data:tree:export
595
1163
 
596
1164
  EXAMPLES
597
- $ sfdx force:data:tree:import -f Contact.json,Account.json -u me@my.org
1165
+ Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
1166
+ uses your default org:
1167
+
1168
+ $ sfdx force:data:tree:export --query "SELECT Id, Name, (SELECT Name, Address\_\_c FROM Properties\_\_r) FROM \
1169
+ Broker\_\_c"
1170
+
1171
+ Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
1172
+ aggregates them:
1173
+
1174
+ $ sfdx force:data:tree:export --query query.txt --plan
1175
+
1176
+ Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the
1177
+ command on the org with alias "my-scratch":
1178
+
1179
+ $ sfdx force:data:tree:export --query query.txt --plan --prefix export-demo --output-dir export-out --target-org \
1180
+ my-scratch
1181
+ ```
1182
+
1183
+ ## `sfdx force:data:tree:import`
1184
+
1185
+ Import data from one or more JSON files into an org.
598
1186
 
599
- $ sfdx force:data:tree:import -p Account-Contact-plan.json -u me@my.org
600
1187
  ```
1188
+ USAGE
1189
+ $ sfdx force:data:tree:import -o <value> [--json] [--api-version <value>] [-f <value> | -p <value>] [--config-help]
1190
+
1191
+ FLAGS
1192
+ -f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
1193
+ that you want to insert.
1194
+ -o, --target-org=<value> (required) Username or alias of the target org.
1195
+ -p, --plan=<value> Plan definition file to insert multiple data files.
1196
+ --api-version=<value> Override the api version used for api requests made by this command
1197
+ --config-help Display schema information for the --plan configuration file to stdout; if you specify this
1198
+ flag, all other flags except --json are ignored.
1199
+
1200
+ GLOBAL FLAGS
1201
+ --json Format output as json.
1202
+
1203
+ DESCRIPTION
1204
+ Import data from one or more JSON files into an org.
1205
+
1206
+ The JSON files that contain the data are in sObject tree format, which is a collection of nested, parent-child records
1207
+ with a single root record. Use the "sfdx data export tree" command to generate these JSON files.
601
1208
 
602
- _See code: [src/commands/force/data/tree/import.ts](https://github.com/salesforcecli/plugin-data/blob/v2.1.1/src/commands/force/data/tree/import.ts)_
1209
+ If you used the --plan flag when exporting the data to generate a plan definition file, use the --plan flag to
1210
+ reference the file when you import. If you're not using a plan, use the --files flag to list the files. If you specify
1211
+ multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
1212
+ order.
1213
+
1214
+ The sObject Tree API supports requests that contain up to 200 records. For more information, see the REST API
1215
+ Developer Guide.
1216
+ (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm)
1217
+
1218
+ ALIASES
1219
+ $ sfdx force:data:tree:import
1220
+
1221
+ EXAMPLES
1222
+ Import the records contained in two JSON files into the org with alias "my-scratch":
1223
+
1224
+ $ sfdx force:data:tree:import --files Contact.json,Account.json --target-org my-scratch
1225
+
1226
+ Import records using a plan definition file into your default org:
1227
+
1228
+ $ sfdx force:data:tree:import --plan Account-Contact-plan.json
1229
+ ```
603
1230
 
604
1231
  <!-- commandsstop -->