@salesforce/plugin-data 3.2.2 → 3.2.4

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