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