ExamGecko
Question list
Search
Search

Question 126 - Certified B2B Commerce Developer discussion

Report
Export

Northern Trail Outfitters (NTO) has acquired a company and is looking to manage product data across the org seamlessly. The company has a governance policy to not install any tool or use third-party API applications to export or import the data into Salesforce. However, users have access to Salesforce CLI.

Which set of tasks must a developer perform whento export data from Salesforce or import data into Salesforce?

A.
sfdx force:data:bulk:export -Product2 -all 0 and sfdx force:data:bulk:lmport -f Product2.json -all
Answers
A.
sfdx force:data:bulk:export -Product2 -all 0 and sfdx force:data:bulk:lmport -f Product2.json -all
B.
sfdx force:data;tree:export -Product2 -all q and sfdx force:data:tree:lmport -f Product2.json -all
Answers
B.
sfdx force:data;tree:export -Product2 -all q and sfdx force:data:tree:lmport -f Product2.json -all
C.
sfdx force:tree:data:export -q 'SELECT Id, Name FROM Product2' -u <your username> and sfdx force:tree:data:import -f Product2Json -all
Answers
C.
sfdx force:tree:data:export -q 'SELECT Id, Name FROM Product2' -u <your username> and sfdx force:tree:data:import -f Product2Json -all
D.
sfdx force:data:tree:export -q 'SELECT Id, Name FROM Product2' -u '<your username>' and sfdx force:data:tree:import -f Product2.json -u w<your username>'
Answers
D.
sfdx force:data:tree:export -q 'SELECT Id, Name FROM Product2' -u '<your username>' and sfdx force:data:tree:import -f Product2.json -u w<your username>'
Suggested answer: D

Explanation:

The correct answer for how to export data from Salesforce or import data into Salesforce using Salesforce CLI commands is running a command like: sfdx force:data:tree:export -q ''SELECT Id, Name FROM Product2'' -u ''<your username>'' and sfdx force:data:tree:import -f Product2.json -u ''<your username>''. The sfdx force:data:tree:export command is a Salesforce CLI command that exports data from an org into JSON files that conform to the SObject Tree API specification. The SObject Tree API specification is a format that defines how records are represented in JSON files for data import or export. The -q flag specifies the SOQL query that selects the records and fields to be exported. The -u flag specifies the username or alias of the org where the data will be exported from. Running this command will generate JSON files that contain the data from the org based on the SOQL query. The sfdx force:data:tree:import command is a Salesforce CLI command that imports data into an org using JSON files that conform to the SObject Tree API specification. The -f flag specifies the path of the JSON file that contains the data to be imported. The -u flag specifies the username or alias of the org where the data will be imported to. Running this command will create records in the org based on the data in the JSON file. Running a command like: sfdx force:data:bulk:export -Product2 -all 0 and sfdx force:data:bulk:import -f Product2.json -all is not a correct answer, as it uses invalid syntax and flags for the sfdx force:data:bulk:export and sfdx force:data:bulk:import commands. The correct syntax and flags for these commands are sfdx force:data:bulk:upsert -s Product2 -f Product2.csv -w 10 -u <your username> and sfdx force:data:bulk:status -i <job ID> -u <your username>. Running a command like: sfdx force:data;tree:export -Product2 -all q and sfdx force:data:tree:import -f Product2.json -all is not a correct answer either, as it uses invalid syntax and flags for the sfdx force:data:tree:export and sfdx force:data:tree:import commands. The correct syntax and flags for these commands are sfdx force:data:tree:export -q ''SELECT Id, Name FROM Product2'' -u <your username> and sfdx force:data:tree:import -f Product2.json -u <your username>. Running a command like: sfdx force:tree:data:export -q ''SELECT Id, Name FROM Product2'' -u <your username> and sfdx force:tree:data:import -f Product2Json -all is not a correct answer either, as there is no such command as sfdx force:tree:data:export or sfdx force:tree:data:import. The correct commands are sfdx force:data:tree:export and sfdx force:data:tree:import. Salesforce

Reference: [Salesforce CLI Command Reference: force:data:tree:export], [Salesforce CLI Command Reference: force:data:tree:import], [Salesforce CLI Command Reference: force:data:bulk], [Salesforce Developer Tools for Visual Studio Code]

asked 23/09/2024
bijay ghimire
37 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first