SF Learners Hub

MASTER SALESFORCE, CONQUER YOUR GOALS

Import multiple Data using a single SFDX Command

Share This Post

1. Document Objective

The purpose of this document is to import the data into multiple objects at the same time.

2. Integration Specifications

Prerequisites: you need to access all the fields which you want to import in org.

Integration Steps:

Step 1- Create a Json File for Objects in which you want to import the Dummy data. For example-:

**write the API Name of the objects and Fields. **

Step 2- After this step, Just create a new JSON for calling another object in the JSON file. For example-:

Note -:

(i) For Creating this plan JSON file always file name save with “filename- plan.json”.

(ii) To create this plan JSON file remember these things:

(a) Always write the Subject name as “object API Name”.

(b) Always write the files field as a “Name of the JSON file”.

Step 3 — Authorize an org using this command.

“sfdx force:org:open -u mydevhub.”

Note: If your org is Successfully Authorize it will show like this :

Step 4 — Run the Command to import the Data in Multiple Objects at the same time.

“sfdx force:data:tree: import -p file path -u mydevhub

Note: If your org is Successfully Authorize and the JSON file is not correct or missing any Required field or Schema is not Correct for the JSON file it will show an error like this :

Note : If your Data is Successfully import in org, it will shown like this :

Some Important tips which will help you create a JSON file correctly.

  • Always write the API Name when writing Object Name or Field Name.
  • Always write the “ID” when writing any Lookup Field value.
  • If you write the date/time field value in a JSON File, it should be in this format looks like:

Date Format: “yyyy-mm-dd”
Time Format: “hrs: minute”

  • If you write any Picklist Field value then write the Picklist value the same as to define at the creation of field value.
  • The checkbox value should be True or False in the JSON file.
  • Always write the String in the Double quotes looks like this: “String value/IDs”.

Conclusion

I hope you like this blog and if you want any help let me know in the comment section.

Stay tuned, there is way more to come! Follow me on LinkedInInstagram, and Twitter. So you won’t miss out on all future articles.

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

The Power of Salesforce Integration

What You’ll Learn What Is Salesforce Integration? Salesforce integration involves combining the data and features of Salesforce with another application, creating a cohesive experience for