The ccUtil apex class in Salesforce B2B Commerce provides numerous utility functions that can be leveraged in subscriber classes. Which command will return the value in the given Map if found or a default value in the event that the Map is null, empty, or an object is not found for that key?
Correct Answer: B
Explanation:
The ccrz.ccUtil.defVal (Map mp, String key, Object ob) method will return the value in the given Map if found or a default value in the event that the Map is null, empty, or an object is not found for that key. This method is useful for providing fallback values for configuration settings or input parameters that may be missing or invalid. Salesforce Reference: B2B Commerce and D2C Commerce Developer Guide, ccUtil Class
Question 2
The ccUtil apex class in Salesforce B2B Commerce provides numerous utility functions that can be leveraged in subscriber classes. What are two ways to check the input or return data of the Global API's? (2 answers)
Correct Answer: A, D
Explanation:
The ccUtil apex class provides two methods to check the input or return data of the Global API’s: ccrz.ccUtil.isNotEmpty(Map) and ccrz.ccUtil.isEmpty(Map). These methods return true if the map is not null and contains at least one entry, or if the map is null or empty, respectively. Similarly, ccrz.ccUtil.isNotEmpty(List
Question 3
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.
Demo Practice Mode
You are viewing only the questions marked as Demo.