Aman Salesforce | Salesforce Tutorial | Import multiple Data using single SFDX Command

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 Create this plan JSON file always file name save with “filename- plan.json”.

(ii)   For Create this plan JSON file remember this thing like :

(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 date/time field value in JSON File, it should be in this format looks like this :

                    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.
  • Checkbox value should be True or False in the JSON file.
  •  Always write the String in the Double quotes looks like this: "String value/ID’s".

Comments

Post a Comment

Popular posts from this blog

Deployment on production Environment in salesforce

Easy way to Integrate Salesforce CLI with Visual Studio code

What is Multi-factor Authentication (MFA)? When and How to Use it? | Salesforce Developer Guide