Import Files Using Bulk API from Salesforce CLI

ย 

๐Ÿ“ข๐Ÿ“ข๐Ÿ“ข

Update sf cli to the latest version to use this(## 2.64.6 (October 30, 2024) [stable]).All the records on the csv file should be same Salesforce object

Use the --๐˜ด๐˜ฐ๐˜ฃ๐˜ซ๐˜ฆ๐˜ค๐˜ต flag to specify the Salesforce object.

๐˜ด๐˜ง ๐˜ฅ๐˜ข๐˜ต๐˜ข ๐˜ช๐˜ฎ๐˜ฑ๐˜ฐ๐˜ณ๐˜ต ๐˜ฃ๐˜ถ๐˜ญ๐˜ฌ --๐˜ง๐˜ช๐˜ญ๐˜ฆ <๐˜ง๐˜ช๐˜ญ๐˜ฆ ๐˜ฏ๐˜ข๐˜ฎ๐˜ฆ> --๐˜ด๐˜ฐ๐˜ฃ๐˜ซ๐˜ฆ๐˜ค๐˜ต <๐˜ด๐˜ถ๐˜ฃ๐˜ซ๐˜ฆ๐˜ค๐˜ต ๐˜ˆ๐˜—๐˜ ๐˜•๐˜ข๐˜ฎ๐˜ฆ> --๐˜ธ๐˜ข๐˜ช๐˜ต <๐˜ธ๐˜ข๐˜ช๐˜ต ๐˜ต๐˜ช๐˜ฎ๐˜ฆ ๐˜ช๐˜ฏ ๐˜ฎ๐˜ช๐˜ฏ๐˜ถ๐˜ต๐˜ฆ๐˜ด> --๐˜ต๐˜ข๐˜ณ๐˜จ๐˜ฆ๐˜ต-๐˜ฐ๐˜ณ๐˜จ <๐˜ฐ๐˜ณ๐˜จ ๐˜ข๐˜ญ๐˜ช๐˜ข๐˜ด>

ย 

๐Ÿ‘‰For example,

Below command imports Account records from the **accounts.csv88 file into an org with alias “my-scratch”:

๐˜ด๐˜ง ๐˜ฅ๐˜ข๐˜ต๐˜ข ๐˜ช๐˜ฎ๐˜ฑ๐˜ฐ๐˜ณ๐˜ต ๐˜ฃ๐˜ถ๐˜ญ๐˜ฌ --๐˜ง๐˜ช๐˜ญ๐˜ฆ ๐˜ข๐˜ค๐˜ค๐˜ฐ๐˜ถ๐˜ฏ๐˜ต๐˜ด.๐˜ค๐˜ด๐˜ท --๐˜ด๐˜ฐ๐˜ฃ๐˜ซ๐˜ฆ๐˜ค๐˜ต ๐˜ˆ๐˜ค๐˜ค๐˜ฐ๐˜ถ๐˜ฏ๐˜ต --๐˜ธ๐˜ข๐˜ช๐˜ต 10 --๐˜ต๐˜ข๐˜ณ๐˜จ๐˜ฆ๐˜ต-๐˜ฐ๐˜ณ๐˜จ ๐˜ฎ๐˜บ-๐˜ด๐˜ค๐˜ณ๐˜ข๐˜ต๐˜ค๐˜ฉ

Thats All๐Ÿช„๐Ÿช„๐Ÿช„

SF CLI Takes care of the rest!๐Ÿง™โœจ

๐Ÿ‘‰As Bulk imports takes time depending on how many records are in the CSV file the command time out after the specified wait time (10 minutes above).in this case it displays a job ID that you can pass to the new data import resume command to see the status and results of the original export.

๐˜ด๐˜ง ๐˜ฅ๐˜ข๐˜ต๐˜ข ๐˜ช๐˜ฎ๐˜ฑ๐˜ฐ๐˜ณ๐˜ต ๐˜ณ๐˜ฆ๐˜ด๐˜ถ๐˜ฎ๐˜ฆ --๐˜ซ๐˜ฐ๐˜ฃ-๐˜ช๐˜ฅ <๐˜‘๐˜ฐ๐˜ฃ ๐˜๐˜ฅ>

Resume the most recently run bulk import job for an org with alias my-scratch:

๐˜ด๐˜ง ๐˜ฅ๐˜ข๐˜ต๐˜ข ๐˜ช๐˜ฎ๐˜ฑ๐˜ฐ๐˜ณ๐˜ต ๐˜ณ๐˜ฆ๐˜ด๐˜ถ๐˜ฎ๐˜ฆ --๐˜ถ๐˜ด๐˜ฆ-๐˜ฎ๐˜ฐ๐˜ด๐˜ต-๐˜ณ๐˜ฆ๐˜ค๐˜ฆ๐˜ฏ๐˜ต --๐˜ต๐˜ข๐˜ณ๐˜จ๐˜ฆ๐˜ต-๐˜ฐ๐˜ณ๐˜จ ๐˜ฎ๐˜บ-๐˜ด๐˜ค๐˜ณ๐˜ข๐˜ต๐˜ค๐˜ฉ

๐Ÿ“Here is a quick demo on the same, the data is queried before and after running the command to verify the records are inserted.

watch demo video on linkedin

SF documentation on data import bulk SF documentation on Prepare Data to Ingest. That is creating csv file for data import.

This Content was originally posted in linkedin View Post