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?
Correct 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 aresfdx force:data:tree:export and sfdx force:data:tree:import. Salesforce References: [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]
B2B-Commerce-Developer Exam Question 2
A developer needs to create a scheduled job in another system to move data into the B2B Commerce org. How can the developer do this without additional third party tools?
Correct Answer: B
Explanation Option B is the correct answer because it describes a way to create a scheduled job in another system to move data into the B2B Commerce org without additional third party tools. The developer can set up an SFTP server as a waystation, drop the files there using the off-platform job and schedule a job in-platform to process the file. This way, the developer can use the built-in integration capabilities of the B2B Commerce platform, such as the Windows Integration Service (WIS) or the Integration Job Definitions, to import the data from the SFTP server into the org. The other options are incorrect because they either require additional third party tools, such as WebDAV or CLI, or they do not create a scheduled job in another system, but rather in the same org. References: Creating and editing integration jobs, Create a B2B Commerce Org and Checkout Flow, B2B Commerce on Lightning Experience Developer Guide, B2B Commerce and D2C Commerce Developer Guide
B2B-Commerce-Developer Exam Question 3
A user wants to have a customized experience for adding items to the cart. The user also wants the mini cart module to reflect changes to the state of the cart afterwords. How should this requirement be fulfilled?
Correct Answer: D
Explanation To have a customized experience for adding items to the cart and also update the mini cart module, the requirement can be fulfilled by triggering the global "cartChange" event after the Add to Cart Action on the custom button. This event will notify all the components that are listening to it that the cart has changedand they should refresh their data accordingly. The mini cart module is one of these components, so it will update its state based on the new cart data. Salesforce References: B2B Commerce and D2C Commerce Developer Guide, Events
B2B-Commerce-Developer Exam Question 4
Although Salesforce B2B Commerce and Salesforce recommend against using "without sharing classes" whenever possible, sometimes it is unavoidable. Which three items will open up a major security hole? (3 answers)
Correct Answer: A,C,D
Explanation Executing dynamic SOQL inside a without sharing class with a bind variable from PageReference.getParameters(), PageReference.getCookies(), or cc_RemoteActionContext class will open up a major security hole because these sources of input are not sanitized and can be manipulated by malicious users to inject SOQL queries that bypass the sharing rules and access data that they are not supposed to see. For example, a user can modify the URL parameters or cookies to include a SOQL query that returns sensitive data from the database. To prevent this, it is recommended to use static SOQL or escape the bind variables before executing dynamic SOQL.
B2B-Commerce-Developer Exam Question 5
A developer is building a custom component in Lightning web components (LWC) that needs to fetch data from an API. Which lifecycle hook should the developer use to make the API call?
Correct Answer: A
Explanation To make an API call in a Lightning web component (LWC), a developer should use the connectedCallback lifecycle hook. The connectedCallback lifecycle hook is invoked when the component is inserted into the DOM. This is the ideal time to make an API call, as the component is ready to receive and display data. The developer can use the fetch API or a third-party library, such as axios, to make the API call and handle the response. The renderedCallback lifecycle hook is not a good choice for making an API call, as it is invoked every time the component is rendered or rerendered. This can cause unnecessary or repeated API calls and affect performance. The errorCallback lifecycle hook is not a good choice either, as it is invoked when an error occurs in the component or in one of its children. This is not related to making an API call, but rather to handling errors. The disconnectedCallback lifecycle hook is not a good choice either, as it is invoked when the component is removed from the DOM. This is not a suitable time to make an API call, as the component is no longer visible or active. Salesforce References: Lightning Web Components Developer Guide: Lifecycle Hooks, Lightning Web Components Developer Guide: Call an Apex Method Imperatively