@salesforce/plugin-data 3.1.11 → 3.2.1

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 (68) hide show
  1. package/README.md +3 -903
  2. package/lib/BulkBaseCommand.js +68 -94
  3. package/lib/BulkBaseCommand.js.map +1 -1
  4. package/lib/api/data/tree/exportApi.js +0 -1
  5. package/lib/api/data/tree/exportApi.js.map +1 -1
  6. package/lib/api/data/tree/importApi.js +2 -13
  7. package/lib/api/data/tree/importApi.js.map +1 -1
  8. package/lib/api/data/tree/importPlan.js.map +1 -1
  9. package/lib/batcher.js +3 -26
  10. package/lib/batcher.js.map +1 -1
  11. package/lib/bulkOperationCommand.js +125 -118
  12. package/lib/bulkOperationCommand.js.map +1 -1
  13. package/lib/bulkUtils.js +13 -24
  14. package/lib/bulkUtils.js.map +1 -1
  15. package/lib/commands/data/create/record.js.map +1 -1
  16. package/lib/commands/data/delete/bulk.js +14 -11
  17. package/lib/commands/data/delete/bulk.js.map +1 -1
  18. package/lib/commands/data/delete/record.js.map +1 -1
  19. package/lib/commands/data/delete/resume.js +1 -4
  20. package/lib/commands/data/delete/resume.js.map +1 -1
  21. package/lib/commands/data/get/record.js.map +1 -1
  22. package/lib/commands/data/import/tree.js +1 -1
  23. package/lib/commands/data/import/tree.js.map +1 -1
  24. package/lib/commands/data/query/resume.js +21 -10
  25. package/lib/commands/data/query/resume.js.map +1 -1
  26. package/lib/commands/data/query.js +38 -12
  27. package/lib/commands/data/query.js.map +1 -1
  28. package/lib/commands/data/resume.js +9 -15
  29. package/lib/commands/data/resume.js.map +1 -1
  30. package/lib/commands/data/update/record.js.map +1 -1
  31. package/lib/commands/data/upsert/bulk.js +16 -13
  32. package/lib/commands/data/upsert/bulk.js.map +1 -1
  33. package/lib/commands/data/upsert/resume.js +1 -4
  34. package/lib/commands/data/upsert/resume.js.map +1 -1
  35. package/lib/commands/force/data/bulk/delete.js +5 -4
  36. package/lib/commands/force/data/bulk/delete.js.map +1 -1
  37. package/lib/commands/force/data/bulk/status.js +1 -1
  38. package/lib/commands/force/data/bulk/status.js.map +1 -1
  39. package/lib/commands/force/data/bulk/upsert.js +6 -6
  40. package/lib/commands/force/data/bulk/upsert.js.map +1 -1
  41. package/lib/dataCommand.js.map +1 -1
  42. package/lib/dataSoqlQueryTypes.js.map +1 -1
  43. package/lib/export.js +1 -1
  44. package/lib/export.js.map +1 -1
  45. package/lib/flags.js +4 -3
  46. package/lib/flags.js.map +1 -1
  47. package/lib/queryUtils.js +3 -1
  48. package/lib/queryUtils.js.map +1 -1
  49. package/lib/reporters/csvReporter.js +78 -0
  50. package/lib/reporters/csvReporter.js.map +1 -0
  51. package/lib/reporters/humanReporter.js +120 -0
  52. package/lib/reporters/humanReporter.js.map +1 -0
  53. package/lib/reporters/reporters.js +69 -0
  54. package/lib/reporters/reporters.js.map +1 -0
  55. package/lib/resumeBulkCommand.js +28 -14
  56. package/lib/resumeBulkCommand.js.map +1 -1
  57. package/messages/batcher.md +3 -3
  58. package/messages/bulk.base.command.md +4 -4
  59. package/messages/bulk.resume.command.md +0 -4
  60. package/messages/importApi.md +2 -2
  61. package/messages/reporter.md +1 -1
  62. package/messages/soql.query.md +0 -4
  63. package/npm-shrinkwrap.json +497 -961
  64. package/oclif.lock +1178 -1545
  65. package/oclif.manifest.json +165 -42
  66. package/package.json +8 -10
  67. package/lib/reporters.js +0 -335
  68. package/lib/reporters.js.map +0 -1
package/README.md CHANGED
@@ -76,909 +76,9 @@ sf plugins
76
76
 
77
77
  <!-- commands -->
78
78
 
79
- - [`sf data create record`](#sf-data-create-record)
80
- - [`sf data delete bulk`](#sf-data-delete-bulk)
81
- - [`sf data delete record`](#sf-data-delete-record)
82
- - [`sf data delete resume`](#sf-data-delete-resume)
83
- - [`sf data export beta tree`](#sf-data-export-beta-tree)
84
- - [`sf data export tree`](#sf-data-export-tree)
85
- - [`sf data get record`](#sf-data-get-record)
86
- - [`sf data import beta tree`](#sf-data-import-beta-tree)
87
- - [`sf data import tree`](#sf-data-import-tree)
88
- - [`sf data query`](#sf-data-query)
89
- - [`sf data query resume`](#sf-data-query-resume)
90
- - [`sf data resume`](#sf-data-resume)
91
- - [`sf data update record`](#sf-data-update-record)
92
- - [`sf data upsert bulk`](#sf-data-upsert-bulk)
93
- - [`sf data upsert resume`](#sf-data-upsert-resume)
94
- - [`sf force data bulk delete`](#sf-force-data-bulk-delete)
95
- - [`sf force data bulk status`](#sf-force-data-bulk-status)
96
- - [`sf force data bulk upsert`](#sf-force-data-bulk-upsert)
79
+ # Command Topics
97
80
 
98
- ## `sf data create record`
99
-
100
- Create and insert a record into a Salesforce or Tooling API object.
101
-
102
- ```
103
- USAGE
104
- $ sf data create record -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-t]
105
-
106
- FLAGS
107
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
108
- configuration variable is already set.
109
- -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're inserting a record
110
- into.
111
- -t, --use-tooling-api Use Tooling API so you can insert a record in a Tooling API object.
112
- -v, --values=<value> (required) Values for the flags in the form <fieldName>=<value>, separate multiple pairs
113
- with spaces.
114
- --api-version=<value> Override the api version used for api requests made by this command
115
-
116
- GLOBAL FLAGS
117
- --json Format output as json.
118
-
119
- DESCRIPTION
120
- Create and insert a record into a Salesforce or Tooling API object.
121
-
122
- You must specify a value for all required fields of the object.
123
-
124
- When specifying fields, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of double
125
- quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
126
-
127
- This command inserts a record into Salesforce objects by default. Use the --use-tooling-api flag to insert into a
128
- Tooling API object.
129
-
130
- ALIASES
131
- $ sf force data record create
132
-
133
- EXAMPLES
134
- Insert a record into the Account object of your default org; only the required Name field has a value:
135
-
136
- $ sf data create record --sobject Account --values "Name=Acme"
137
-
138
- Insert an Account record with values for two fields, one value contains a space; the command uses the org with alias
139
- "my-scratch":
140
-
141
- $ sf data create record --sobject Account --values "Name='Universal Containers' Website=www.example.com" \
142
- --target-org my-scratch
143
-
144
- Insert a record into the Tooling API object TraceFlag:
145
-
146
- $ sf data create record --use-tooling-api --sobject TraceFlag --values "DebugLevelId=7dl170000008U36AAE \
147
- StartDate=2022-12-15T00:26:04.000+0000 ExpirationDate=2022-12-15T00:56:04.000+0000 LogType=CLASS_TRACING \
148
- TracedEntityId=01p17000000R6bLAAS"
149
- ```
150
-
151
- _See code: [src/commands/data/create/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/create/record.ts)_
152
-
153
- ## `sf data delete bulk`
154
-
155
- Bulk delete records from an org using a CSV file. Uses Bulk API 2.0.
156
-
157
- ```
158
- USAGE
159
- $ sf data delete bulk -o <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value> | -a] [--verbose]
160
-
161
- FLAGS
162
- -a, --async Run the command asynchronously.
163
- -f, --file=<value> (required) CSV file that contains the IDs of the records to update or delete.
164
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
165
- configuration variable is already set.
166
- -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
167
- update or delete records from.
168
- -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
169
- displaying the results.
170
- --api-version=<value> Override the api version used for api requests made by this command
171
- --verbose Print verbose output of failed records if result is available.
172
-
173
- GLOBAL FLAGS
174
- --json Format output as json.
175
-
176
- DESCRIPTION
177
- Bulk delete records from an org using a CSV file. Uses Bulk API 2.0.
178
-
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.
180
-
181
- When you execute this command, it starts a job, displays the ID, and then immediately returns control of the terminal
182
- to you by default. If you prefer to wait, set the --wait flag to the number of minutes; if it times out, the command
183
- outputs the IDs. Use the job ID to check the status of the job with the "sf data delete resume" command.
184
-
185
- EXAMPLES
186
- Bulk delete Account records from your default org using the list of IDs in the "files/delete.csv" file:
187
-
188
- $ sf data delete bulk --sobject Account --file files/delete.csv
189
-
190
- Bulk delete records from a custom object in an org with alias my-scratch and wait 5 minutes for the command to
191
- complete:
192
-
193
- $ sf data delete bulk --sobject MyObject__c --file files/delete.csv --wait 5 --target-org my-scratch
194
- ```
195
-
196
- _See code: [src/commands/data/delete/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/delete/bulk.ts)_
197
-
198
- ## `sf data delete record`
199
-
200
- Deletes a single record from a Salesforce or Tooling API object.
201
-
202
- ```
203
- USAGE
204
- $ sf data delete record -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
205
-
206
- FLAGS
207
- -i, --record-id=<value> ID of the record you’re deleting.
208
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
209
- configuration variable is already set.
210
- -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're deleting a record
211
- from.
212
- -t, --use-tooling-api Use Tooling API so you can delete a record from a Tooling API object.
213
- -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to delete.
214
- --api-version=<value> Override the api version used for api requests made by this command
215
-
216
- GLOBAL FLAGS
217
- --json Format output as json.
218
-
219
- DESCRIPTION
220
- Deletes a single record from a Salesforce or Tooling API object.
221
-
222
- Specify the record you want to delete with either its ID or with a list of field-value pairs that identify the record.
223
- If your list of fields identifies more than one record, the delete fails; the error displays how many records were
224
- found.
225
-
226
- When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
227
- double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
228
-
229
- This command deletes a record from Salesforce objects by default. Use the --use-tooling-api flag to delete from a
230
- Tooling API object.
231
-
232
- ALIASES
233
- $ sf force data record delete
234
-
235
- EXAMPLES
236
- Delete a record from Account with the specified (truncated) ID:
237
-
238
- $ sf data delete record --sobject Account --record-id 00180XX
239
-
240
- Delete a record from Account whose name equals "Acme":
241
-
242
- $ sf data delete record --sobject Account --where "Name=Acme"
243
-
244
- Delete a record from Account identified with two field values, one that contains a space; the command uses the org
245
- with alias "my-scratch":
246
-
247
- $ sf data delete record --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" \
248
- --target-org myscratch
249
-
250
- Delete a record from the Tooling API object TraceFlag with the specified (truncated) ID:
251
-
252
- $ sf data delete record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
253
- ```
254
-
255
- _See code: [src/commands/data/delete/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/delete/record.ts)_
256
-
257
- ## `sf data delete resume`
258
-
259
- Resume a bulk delete job that you previously started. Uses Bulk API 2.0.
260
-
261
- ```
262
- USAGE
263
- $ sf data delete resume [--json] [-o <value>] [--use-most-recent | -i <value>] [--wait <value>] [--api-version
264
- <value>]
265
-
266
- FLAGS
267
- -i, --job-id=<value> ID of the job you want to resume.
268
- -o, --target-org=<value> Org alias or username to use for the target org.
269
- --api-version=<value> Override the api version used for api requests made by this command
270
- --use-most-recent Use the ID of the most recently-run bulk job.
271
- --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
272
- displaying the results.
273
-
274
- GLOBAL FLAGS
275
- --json Format output as json.
276
-
277
- DESCRIPTION
278
- Resume a bulk delete job that you previously started. Uses Bulk API 2.0.
279
-
280
- The command uses the job ID returned by the "sf data delete bulk" command or the most recently-run bulk delete job.
281
-
282
- EXAMPLES
283
- Resume a bulk delete job from your default org using an ID:
284
-
285
- $ sf data delete resume --job-id 750xx000000005sAAA
286
-
287
- Resume the most recently run bulk delete job for an org with alias my-scratch:
288
-
289
- $ sf data delete resume --use-most-recent --target-org my-scratch
290
- ```
291
-
292
- _See code: [src/commands/data/delete/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/delete/resume.ts)_
293
-
294
- ## `sf data export beta tree`
295
-
296
- Export data from an org into one or more JSON files.
297
-
298
- ```
299
- USAGE
300
- $ sf data export beta tree -o <value> -q <value> [--json] [--api-version <value>] [-p] [-x <value>] [-d <value>]
301
-
302
- FLAGS
303
- -d, --output-dir=<value> Directory in which to generate the JSON files; default is current directory.
304
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
305
- configuration variable is already set.
306
- -p, --plan Generate multiple sObject tree files and a plan definition file for aggregated import.
307
- -q, --query=<value> (required) SOQL query, or filepath of a file that contains the query, to retrieve records.
308
- -x, --prefix=<value> Prefix of generated files.
309
- --api-version=<value> Override the api version used for api requests made by this command
310
-
311
- GLOBAL FLAGS
312
- --json Format output as json.
313
-
314
- DESCRIPTION
315
- Export data from an org into one or more JSON files.
316
-
317
- Specify a SOQL query, either directly at the command line or read from a file, to retrieve the data you want to
318
- export. The exported data is written to JSON files in sObject tree format, which is a collection of nested,
319
- parent-child records with a single root record. Use these JSON files to import data into an org with the "sf data
320
- import tree" command.
321
-
322
- If your SOQL query references multiple objects, the command generates a single JSON file by default. You can specify
323
- the --plan flag to generate separate JSON files for each object and a plan definition file that aggregates them. You
324
- then specify just this plan definition file when you import the data into an org.
325
-
326
- The SOQL query can return a maximum of 2,000 records. For more information, see the REST API Developer Guide.
327
- (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm).
328
-
329
- EXAMPLES
330
- Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
331
- uses your default org:
332
-
333
- $ sf data export beta tree --query "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM \
334
- Broker__c"
335
-
336
- Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
337
- aggregates them:
338
-
339
- $ sf data export beta tree --query query.txt --plan
340
-
341
- Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the
342
- command on the org with alias "my-scratch":
343
-
344
- $ sf data export beta tree --query query.txt --plan --prefix export-demo --output-dir export-out --target-org \
345
- my-scratch
346
- ```
347
-
348
- _See code: [src/commands/data/export/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/export/beta/tree.ts)_
349
-
350
- ## `sf data export tree`
351
-
352
- Export data from an org into one or more JSON files.
353
-
354
- ```
355
- USAGE
356
- $ sf data export tree -o <value> -q <value> [--json] [--api-version <value>] [-p] [-x <value>] [-d <value>]
357
-
358
- FLAGS
359
- -d, --output-dir=<value> Directory in which to generate the JSON files; default is current directory.
360
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
361
- configuration variable is already set.
362
- -p, --plan Generate multiple sObject tree files and a plan definition file for aggregated import.
363
- -q, --query=<value> (required) SOQL query, or filepath of a file that contains the query, to retrieve records.
364
- -x, --prefix=<value> Prefix of generated files.
365
- --api-version=<value> Override the api version used for api requests made by this command
366
-
367
- GLOBAL FLAGS
368
- --json Format output as json.
369
-
370
- DESCRIPTION
371
- Export data from an org into one or more JSON files.
372
-
373
- Specify a SOQL query, either directly at the command line or read from a file, to retrieve the data you want to
374
- export. The exported data is written to JSON files in sObject tree format, which is a collection of nested,
375
- parent-child records with a single root record. Use these JSON files to import data into an org with the "sf data
376
- import tree" command.
377
-
378
- If your SOQL query references multiple objects, the command generates a single JSON file by default. You can specify
379
- the --plan flag to generate separate JSON files for each object and a plan definition file that aggregates them. You
380
- then specify just this plan definition file when you import the data into an org.
381
-
382
- The SOQL query can return a maximum of 2,000 records. For more information, see the REST API Developer Guide.
383
- (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm).
384
-
385
- ALIASES
386
- $ sf force data tree export
387
-
388
- EXAMPLES
389
- Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command
390
- uses your default org:
391
-
392
- $ sf data export tree --query "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM Broker__c"
393
-
394
- Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that
395
- aggregates them:
396
-
397
- $ sf data export tree --query query.txt --plan
398
-
399
- Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the
400
- command on the org with alias "my-scratch":
401
-
402
- $ sf data export tree --query query.txt --plan --prefix export-demo --output-dir export-out --target-org \
403
- my-scratch
404
- ```
405
-
406
- _See code: [src/commands/data/export/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/export/tree.ts)_
407
-
408
- ## `sf data get record`
409
-
410
- Retrieve and display a single record of a Salesforce or Tooling API object.
411
-
412
- ```
413
- USAGE
414
- $ sf data get record -o <value> -s <value> [--json] [--api-version <value>] [-i <value>] [-w <value>] [-t]
415
-
416
- FLAGS
417
- -i, --record-id=<value> ID of the record you’re retrieving.
418
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
419
- configuration variable is already set.
420
- -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that you're retrieving a record
421
- from.
422
- -t, --use-tooling-api Use Tooling API so you can retrieve a record from a Tooling API object.
423
- -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to display.
424
- --api-version=<value> Override the api version used for api requests made by this command
425
-
426
- GLOBAL FLAGS
427
- --json Format output as json.
428
-
429
- DESCRIPTION
430
- Retrieve and display a single record of a Salesforce or Tooling API object.
431
-
432
- Specify the record you want to retrieve with either its ID or with a list of field-value pairs that identify the
433
- record. If your list of fields identifies more than one record, the command fails; the error displays how many records
434
- were found.
435
-
436
- When specifying field-value pairs, use the format <fieldName>=<value>. Enclose all field-value pairs in one set of
437
- double quotation marks, delimited by spaces. Enclose values that contain spaces in single quotes.
438
-
439
- The command displays all the record's fields and their values, one field per terminal line. Fields with no values are
440
- displayed as "null".
441
-
442
- This command retrieves a record from Salesforce objects by default. Use the --use-tooling-api flag to retrieve from a
443
- Tooling API object.
444
-
445
- ALIASES
446
- $ sf force data record get
447
-
448
- EXAMPLES
449
- Retrieve and display a record from Account with the specified (truncated) ID:
450
-
451
- $ sf data get record --sobject Account --record-id 00180XX
452
-
453
- Retrieve a record from Account whose name equals "Acme":
454
-
455
- $ sf data get record --sobject Account --where "Name=Acme"
456
-
457
- Retrieve a record from Account identified with two field values, one that contains a space; the command uses the org
458
- with alias "my-scratch":
459
-
460
- $ sf data get record --sobject Account --where "Name='Universal Containers' Phone='(123) 456-7890'" --target-org \
461
- myscratch
462
-
463
- Retrieve a record from the Tooling API object TraceFlag with the specified (truncated) ID:
464
-
465
- $ sf data get record --use-tooling-api --sobject TraceFlag --record-id 7tf8c
466
- ```
467
-
468
- _See code: [src/commands/data/get/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/get/record.ts)_
469
-
470
- ## `sf data import beta tree`
471
-
472
- Import data from one or more JSON files into an org.
473
-
474
- ```
475
- USAGE
476
- $ sf data import beta tree -o <value> [--json] [--api-version <value>] [-f <value>] [-p <value>]
477
-
478
- FLAGS
479
- -f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
480
- that you want to insert.
481
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
482
- configuration variable is already set.
483
- -p, --plan=<value> Plan definition file to insert multiple data files.
484
- --api-version=<value> Override the api version used for api requests made by this command
485
-
486
- GLOBAL FLAGS
487
- --json Format output as json.
488
-
489
- DESCRIPTION
490
- Import data from one or more JSON files into an org.
491
-
492
- The JSON files that contain the data are in sObject tree format, which is a collection of nested, parent-child records
493
- with a single root record. Use the "sf data export tree" command to generate these JSON files.
494
-
495
- If you used the --plan flag when exporting the data to generate a plan definition file, use the --plan flag to
496
- reference the file when you import. If you're not using a plan, use the --files flag to list the files. If you specify
497
- multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
498
- order.
499
-
500
- EXAMPLES
501
- Import the records contained in two JSON files into the org with alias "my-scratch":
502
-
503
- $ sf data import beta tree --files Contact.json,Account.json --target-org my-scratch
504
-
505
- Import records using a plan definition file into your default org:
506
-
507
- $ sf data import beta tree --plan Account-Contact-plan.json
508
- ```
509
-
510
- _See code: [src/commands/data/import/beta/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/import/beta/tree.ts)_
511
-
512
- ## `sf data import tree`
513
-
514
- Import data from one or more JSON files into an org.
515
-
516
- ```
517
- USAGE
518
- $ sf data import tree -o <value> [--json] [--api-version <value>] [-f <value> | -p <value>]
519
-
520
- FLAGS
521
- -f, --files=<value>... Comma-separated and in-order JSON files that contain the records, in sObject tree format,
522
- that you want to insert.
523
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
524
- configuration variable is already set.
525
- -p, --plan=<value> Plan definition file to insert multiple data files.
526
- --api-version=<value> Override the api version used for api requests made by this command
527
-
528
- GLOBAL FLAGS
529
- --json Format output as json.
530
-
531
- DESCRIPTION
532
- Import data from one or more JSON files into an org.
533
-
534
- The JSON files that contain the data are in sObject tree format, which is a collection of nested, parent-child records
535
- with a single root record. Use the "sf data export tree" command to generate these JSON files.
536
-
537
- If you used the --plan flag when exporting the data to generate a plan definition file, use the --plan flag to
538
- reference the file when you import. If you're not using a plan, use the --files flag to list the files. If you specify
539
- multiple JSON files that depend on each other in a parent-child relationship, be sure you list them in the correct
540
- order.
541
-
542
- The sObject Tree API supports requests that contain up to 200 records. For more information, see the REST API
543
- Developer Guide.
544
- (https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm)
545
-
546
- ALIASES
547
- $ sf force data tree import
548
-
549
- EXAMPLES
550
- Import the records contained in two JSON files into the org with alias "my-scratch":
551
-
552
- $ sf data import tree --files Contact.json,Account.json --target-org my-scratch
553
-
554
- Import records using a plan definition file into your default org:
555
-
556
- $ sf data import tree --plan Account-Contact-plan.json
557
- ```
558
-
559
- _See code: [src/commands/data/import/tree.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/import/tree.ts)_
560
-
561
- ## `sf data query`
562
-
563
- Execute a SOQL query.
564
-
565
- ```
566
- USAGE
567
- $ sf data query -o <value> [--json] [--api-version <value>] [-q <value>] [-f <value>] [-w <value> [-b | -t]]
568
- [--async ] [--all-rows] [-r human|json|csv]
569
-
570
- FLAGS
571
- -b, --bulk Use Bulk API 2.0 to run the query.
572
- -f, --file=<value> File that contains the SOQL query.
573
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
574
- configuration variable is already set.
575
- -q, --query=<value> SOQL query to execute.
576
- -r, --result-format=<option> [default: human] Format to display the results; the --json flag overrides this flag.
577
- <options: human|json|csv>
578
- -t, --use-tooling-api Use Tooling API so you can run queries on Tooling API objects.
579
- -w, --wait=<value> Time to wait for the command to finish, in minutes.
580
- --all-rows Include deleted records. By default, deleted records are not returned.
581
- --api-version=<value> Override the api version used for api requests made by this command
582
- --async Use Bulk API 2.0, but don't wait for the job to complete.
583
-
584
- GLOBAL FLAGS
585
- --json Format output as json.
586
-
587
- DESCRIPTION
588
- Execute a SOQL query.
589
-
590
- Specify the SOQL query at the command line with the --query flag or read the query from a file with the --file flag.
591
-
592
- If your query returns more than 10,000 records, specify the --bulk flag. The command then runs the query using Bulk
593
- API 2.0, which has higher limits than the default API used by the command.
594
-
595
- When using --bulk, the command waits 3 minutes by default for the query to complete. Use the --wait parameter to
596
- specify a different number of minutes to wait, or set --wait to 0 to immediately return control to the terminal. If
597
- you set --wait to 0, or you use the --async flag, or the command simply times out, the command displays an ID. Pass
598
- this ID to the the "data query resume" command using the --bulk-query-id flag to get the results; pass the ID to the
599
- "data resume" command to get the job status.
600
-
601
- ALIASES
602
- $ sf force data soql query
603
-
604
- EXAMPLES
605
- Specify a SOQL query at the command line; the command uses your default org:
606
-
607
- $ sf data query --query "SELECT Id, Name, Account.Name FROM Contact"
608
-
609
- Read the SOQL query from a file called "query.txt"; the command uses the org with alias "my-scratch":
610
-
611
- $ sf data query --file query.txt --target-org my-scratch
612
-
613
- Use Tooling API to run a query on the ApexTrigger Tooling API object:
614
-
615
- $ sf data query --query "SELECT Name FROM ApexTrigger" --use-tooling-api
616
-
617
- Use Bulk API 2.0 to run a query that returns many rows, and return control to the terminal immediately:
618
-
619
- $ sf data query --query "SELECT Id FROM Contact" --bulk --wait 0
620
- ```
621
-
622
- _See code: [src/commands/data/query.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/query.ts)_
623
-
624
- ## `sf data query resume`
625
-
626
- View the status of a bulk query.
627
-
628
- ```
629
- USAGE
630
- $ sf data query resume [--json] [-o <value>] [--api-version <value>] [-r human|json|csv] [--use-most-recent | -i
631
- <value>]
632
-
633
- FLAGS
634
- -i, --bulk-query-id=<value> Job ID of the bulk query.
635
- -o, --target-org=<value> Org alias or username to use for the target org.
636
- -r, --result-format=<option> [default: human] Format to display the results; the --json flag overrides this flag.
637
- <options: human|json|csv>
638
- --api-version=<value> Override the api version used for api requests made by this command
639
- --use-most-recent Use the most recent bulk query ID from cache.
640
-
641
- GLOBAL FLAGS
642
- --json Format output as json.
643
-
644
- DESCRIPTION
645
- View the status of a bulk query.
646
-
647
- Run this command using the job ID returned from the "sf data query --bulk" command.
648
-
649
- ALIASES
650
- $ sf force data soql bulk report
651
-
652
- EXAMPLES
653
- View the status of a bulk query with the specified ID:
654
-
655
- $ sf data query resume --bulk-query-id 7500x000005BdFzXXX
656
- ```
657
-
658
- _See code: [src/commands/data/query/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/query/resume.ts)_
659
-
660
- ## `sf data resume`
661
-
662
- View the status of a bulk data load job or batch.
663
-
664
- ```
665
- USAGE
666
- $ sf data resume -o <value> -i <value> [--json] [--api-version <value>] [-b <value>]
667
-
668
- FLAGS
669
- -b, --batch-id=<value> ID of the batch whose status you want to view; you must also specify the job ID.
670
- -i, --job-id=<value> (required) ID of the job whose status you want to view.
671
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
672
- configuration variable is already set.
673
- --api-version=<value> Override the api version used for api requests made by this command
674
-
675
- GLOBAL FLAGS
676
- --json Format output as json.
677
-
678
- DESCRIPTION
679
- View the status of a bulk data load job or batch.
680
-
681
- Run this command using the job ID or batch ID returned from the "sf data delete bulk" or "sf data upsert bulk"
682
- commands.
683
-
684
- EXAMPLES
685
- View the status of a bulk load job:
686
-
687
- $ sf data resume --job-id 750xx000000005sAAA
688
-
689
- View the status of a bulk load job and a specific batches:
690
-
691
- $ sf data resume --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA
692
- ```
693
-
694
- _See code: [src/commands/data/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/resume.ts)_
695
-
696
- ## `sf data update record`
697
-
698
- Updates a single record of a Salesforce or Tooling API object.
699
-
700
- ```
701
- USAGE
702
- $ sf data update record -o <value> -s <value> -v <value> [--json] [--api-version <value>] [-i <value>] [-w <value>]
703
- [-t]
704
-
705
- FLAGS
706
- -i, --record-id=<value> ID of the record you’re updating.
707
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
708
- configuration variable is already set.
709
- -s, --sobject=<value> (required) API name of the Salesforce or Tooling API object that contains the record you're
710
- updating.
711
- -t, --use-tooling-api Use Tooling API so you can update a record in a Tooling API object.
712
- -v, --values=<value> (required) Fields that you're updating, in the format of <fieldName>=<value> pairs.
713
- -w, --where=<value> List of <fieldName>=<value> pairs that identify the record you want to update.
714
- --api-version=<value> Override the api version used for api requests made by this command
715
-
716
- GLOBAL FLAGS
717
- --json Format output as json.
718
-
719
- DESCRIPTION
720
- Updates a single record of a Salesforce or Tooling API object.
721
-
722
- Specify the record you want to update with either its ID or with a list of field-value pairs that identify the record.
723
- If your list of fields identifies more than one record, the update fails; the error displays how many records were
724
- found.
725
-
726
- When using field-value pairs for both identifying the record and specifiyng the new field values, use the format
727
- <fieldName>=<value>. Enclose all field-value pairs in one set of double quotation marks, delimited by spaces. Enclose
728
- values that contain spaces in single quotes.
729
-
730
- This command updates a record in Salesforce objects by default. Use the --use-tooling-api flag to update a Tooling API
731
- object.
732
-
733
- ALIASES
734
- $ sf force data record update
735
-
736
- EXAMPLES
737
- Update the Name field of an Account record with the specified (truncated) ID:
738
-
739
- $ sf data update record --sobject Account --record-id 001D0 --values "Name=NewAcme"
740
-
741
- Update the Name field of an Account record whose current name is 'Old Acme':
742
-
743
- $ sf data update record --sobject Account --where "Name='Old Acme'" --values "Name='New Acme'"
744
-
745
- Update the Name and Website fields of an Account record with the specified (truncated) ID:
746
-
747
- $ sf data update record --sobject Account --record-id 001D0 --values "Name='Acme III' Website=www.example.com"
748
-
749
- Update the ExpirationDate field of a record of the Tooling API object TraceFlag using the specified (truncated) ID:
750
-
751
- $ sf data update record -t --sobject TraceFlag --record-id 7tf170000009cUBAAY --values \
752
- "ExpirationDate=2017-12-01T00:58:04.000+0000"
753
- ```
754
-
755
- _See code: [src/commands/data/update/record.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/update/record.ts)_
756
-
757
- ## `sf data upsert bulk`
758
-
759
- Bulk upsert records to an org from a CSV file. Uses Bulk API 2.0.
760
-
761
- ```
762
- USAGE
763
- $ sf data upsert bulk -o <value> -f <value> -s <value> -i <value> [--json] [--api-version <value>] [-w <value> | -a]
764
- [--verbose]
765
-
766
- FLAGS
767
- -a, --async Run the command asynchronously.
768
- -f, --file=<value> (required) CSV file that contains the IDs of the records to update or delete.
769
- -i, --external-id=<value> (required) Name of the external ID field, or the Id field.
770
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
771
- configuration variable is already set.
772
- -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
773
- update or delete records from.
774
- -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
775
- displaying the results.
776
- --api-version=<value> Override the api version used for api requests made by this command
777
- --verbose Print verbose output of failed records if result is available.
778
-
779
- GLOBAL FLAGS
780
- --json Format output as json.
781
-
782
- DESCRIPTION
783
- Bulk upsert records to an org from a CSV file. Uses Bulk API 2.0.
784
-
785
- An upsert refers to inserting a record into a Salesforce object if the record doesn't already exist, or updating it if
786
- it does exist.
787
-
788
- When you execute this command, it starts a job, displays the ID, and then immediately returns control of the terminal
789
- to you by default. If you prefer to wait, set the --wait flag to the number of minutes; if it times out, the command
790
- outputs the IDs. Use the job and batch IDs to check the status of the job with the "sf data upsert resume" command.
791
-
792
- See "Prepare CSV Files" in the Bulk API Developer Guide for details on formatting your CSV file.
793
- (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_prepare_csv.htm)
794
-
795
- EXAMPLES
796
- Bulk upsert records to the Contact object in your default org:
797
-
798
- $ sf data upsert bulk --sobject Contact --file files/contacts.csv --external-id Id
799
-
800
- Bulk upsert records to a custom object in an org with alias my-scratch and wait 5 minutes for the command to
801
- complete:
802
-
803
- $ sf data upsert bulk --sobject MyObject__c --file files/file.csv --external-id MyField__c --wait 5 --target-org \
804
- my-scratch
805
- ```
806
-
807
- _See code: [src/commands/data/upsert/bulk.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/upsert/bulk.ts)_
808
-
809
- ## `sf data upsert resume`
810
-
811
- Resume a bulk upsert job that you previously started. Uses Bulk API 2.0.
812
-
813
- ```
814
- USAGE
815
- $ sf data upsert resume [--json] [-o <value>] [--use-most-recent | -i <value>] [--wait <value>] [--api-version
816
- <value>]
817
-
818
- FLAGS
819
- -i, --job-id=<value> ID of the job you want to resume.
820
- -o, --target-org=<value> Org alias or username to use for the target org.
821
- --api-version=<value> Override the api version used for api requests made by this command
822
- --use-most-recent Use the ID of the most recently-run bulk job.
823
- --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
824
- displaying the results.
825
-
826
- GLOBAL FLAGS
827
- --json Format output as json.
828
-
829
- DESCRIPTION
830
- Resume a bulk upsert job that you previously started. Uses Bulk API 2.0.
831
-
832
- The command uses the job ID returned from the "sf data upsert bulk" command or the most recently-run bulk upsert job.
833
-
834
- EXAMPLES
835
- Resume a bulk upsert job from your default org using an ID:
836
-
837
- $ sf data upsert resume --job-id 750xx000000005sAAA
838
-
839
- Resume the most recently run bulk upsert job for an org with alias my-scratch:
840
-
841
- $ sf data upsert resume --use-most-recent --target-org my-scratch
842
- ```
843
-
844
- _See code: [src/commands/data/upsert/resume.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/data/upsert/resume.ts)_
845
-
846
- ## `sf force data bulk delete`
847
-
848
- Bulk delete records from an org using a CSV file. Uses Bulk API 1.0.
849
-
850
- ```
851
- USAGE
852
- $ sf force data bulk delete -o <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
853
-
854
- FLAGS
855
- -f, --file=<value> (required) CSV file that contains the IDs of the records to delete.
856
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
857
- configuration variable is already set.
858
- -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
859
- delete records from.
860
- -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
861
- displaying the results.
862
- --api-version=<value> Override the api version used for api requests made by this command
863
-
864
- GLOBAL FLAGS
865
- --json Format output as json.
866
-
867
- DESCRIPTION
868
- Bulk delete records from an org using a CSV file. Uses Bulk API 1.0.
869
-
870
- The CSV file must have only one column ("Id") and then the list of record IDs you want to delete, one ID per line.
871
-
872
- When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
873
- returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
874
- minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
875
- the "sf force data bulk status" command. A single job can contain many batches, depending on the length of the CSV
876
- file.
877
-
878
- EXAMPLES
879
- Bulk delete Account records from your default org using the list of IDs in the "files/delete.csv" file:
880
-
881
- $ sf force data bulk delete --sobject Account --file files/delete.csv
882
-
883
- Bulk delete records from a custom object in an org with alias my-scratch and wait 5 minutes for the command to
884
- complete:
885
-
886
- $ sf force data bulk delete --sobject MyObject__c --file files/delete.csv --wait 5 --target-org my-scratch
887
- ```
888
-
889
- _See code: [src/commands/force/data/bulk/delete.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/force/data/bulk/delete.ts)_
890
-
891
- ## `sf force data bulk status`
892
-
893
- View the status of a bulk data load job or batch. Uses Bulk API 1.0.
894
-
895
- ```
896
- USAGE
897
- $ sf force data bulk status -o <value> -i <value> [--json] [--api-version <value>] [-b <value>]
898
-
899
- FLAGS
900
- -b, --batch-id=<value> ID of the batch whose status you want to view; you must also specify the job ID.
901
- -i, --job-id=<value> (required) ID of the job whose status you want to view.
902
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
903
- configuration variable is already set.
904
- --api-version=<value> Override the api version used for api requests made by this command
905
-
906
- GLOBAL FLAGS
907
- --json Format output as json.
908
-
909
- DESCRIPTION
910
- View the status of a bulk data load job or batch. Uses Bulk API 1.0.
911
-
912
- Run this command using the job ID or batch ID returned from the "sf force data bulk delete" or "sf force data bulk
913
- upsert" commands.
914
-
915
- EXAMPLES
916
- View the status of a bulk load job in your default org:
917
-
918
- $ sf force data bulk status --job-id 750xx000000005sAAA
919
-
920
- View the status of a bulk load job and a specific batches in an org with alias my-scratch:
921
-
922
- $ sf force data bulk status --job-id 750xx000000005sAAA --batch-id 751xx000000005nAAA --target-org my-scratch
923
- ```
924
-
925
- _See code: [src/commands/force/data/bulk/status.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/force/data/bulk/status.ts)_
926
-
927
- ## `sf force data bulk upsert`
928
-
929
- Bulk upsert records to an org from a CSV file. Uses Bulk API 1.0.
930
-
931
- ```
932
- USAGE
933
- $ sf force data bulk upsert -o <value> -i <value> -f <value> -s <value> [--json] [--api-version <value>] [-w <value>]
934
- [-r]
935
-
936
- FLAGS
937
- -f, --file=<value> (required) CSV file that contains the records to upsert.
938
- -i, --external-id=<value> (required) Name of the external ID field, or the Id field.
939
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
940
- configuration variable is already set.
941
- -r, --serial Run batches in serial mode.
942
- -s, --sobject=<value> (required) API name of the Salesforce object, either standard or custom, that you want to
943
- upsert records to.
944
- -w, --wait=<value> [default: 0 minutes] Number of minutes to wait for the command to complete before
945
- displaying the results.
946
- --api-version=<value> Override the api version used for api requests made by this command
947
-
948
- GLOBAL FLAGS
949
- --json Format output as json.
950
-
951
- DESCRIPTION
952
- Bulk upsert records to an org from a CSV file. Uses Bulk API 1.0.
953
-
954
- An upsert refers to inserting a record into a Salesforce object if the record doesn't already exist, or updating it if
955
- it does exist.
956
-
957
- When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately
958
- returns control of the terminal to you by default. If you prefer to wait, set the --wait flag to the number of
959
- minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with
960
- the "sf force data bulk status" command. A single job can contain many batches, depending on the length of the CSV
961
- file.
962
-
963
- See "Prepare CSV Files" in the Bulk API Developer Guide for details on formatting your CSV file.
964
- (https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_preparing.htm)
965
-
966
- By default, the job runs the batches in parallel, which we recommend. You can run jobs serially by specifying the
967
- --serial flag. But don't process data in serial mode unless you know this would otherwise result in lock timeouts and
968
- you can't reorganize your batches to avoid the locks.
969
-
970
- EXAMPLES
971
- Bulk upsert records to the Contact object in your default org:
972
-
973
- $ sf --sobject Contact --file files/contacts.csv --external-id Id
974
-
975
- Bulk upsert records to a custom object in an org with alias my-scratch and wait 5 minutes for the command to
976
- complete:
977
-
978
- $ sf force data bulk upsert --sobject MyObject__c --file files/file.csv --external-id MyField__c --wait 5 \
979
- --target-org my-scratch
980
- ```
981
-
982
- _See code: [src/commands/force/data/bulk/upsert.ts](https://github.com/salesforcecli/plugin-data/blob/3.1.11/src/commands/force/data/bulk/upsert.ts)_
81
+ - [`sf data`](docs/data.md) - Manage records in your org.
82
+ - [`sf force`](docs/force.md) - Legacy commands for backward compatibility.
983
83
 
984
84
  <!-- commandsstop -->