Multiple Objects Data

How to Import Multiple Objects Data in a Single SFDX Command | Salesforce Guide

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-:

multiple Objects

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

dont miss out iconDon't forget to check out: Using a Salesforce Data Import Wizard - All you Need to Know

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

JSON file

(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 :

  • Always write the Subject name as “object API Name”.
  • 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.”
https://www.blogger.com/blog/post/edit/3510996650939203654/6714480464848908752#

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

Import multiple Objects

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:

Schema

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

Object Name

dont miss out iconCheck out an amazing Salesforce video tutorial here: Data Import: Prepare your Data for Import | Salesforce

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”.

Responses

Popular Salesforce Blogs